Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1d4ac3d4
Commit
1d4ac3d4
authored
May 22, 2019
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
5de08a53
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
55 deletions
+30
-55
mysql-test/r/derived.result
mysql-test/r/derived.result
+0
-1
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+3
-1
mysql-test/r/multi_update_innodb.result
mysql-test/r/multi_update_innodb.result
+3
-0
mysql-test/t/derived.test
mysql-test/t/derived.test
+0
-3
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+3
-6
mysql-test/t/multi_update_innodb.test
mysql-test/t/multi_update_innodb.test
+4
-0
sql/sql_base.cc
sql/sql_base.cc
+3
-5
sql/sql_base.h
sql/sql_base.h
+1
-11
sql/sql_update.cc
sql/sql_update.cc
+13
-28
No files found.
mysql-test/r/derived.result
View file @
1d4ac3d4
drop table if exists t1,t2,t3;
set @save_derived_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
select * from (select 2 from DUAL) b;
...
...
mysql-test/r/multi_update.result
View file @
1d4ac3d4
...
...
@@ -1038,4 +1038,6 @@ triggered
triggered
drop table t1,t2, t3;
drop user foo;
end of 5.5 tests
#
# end of 5.5 tests
#
mysql-test/r/multi_update_innodb.result
View file @
1d4ac3d4
...
...
@@ -67,3 +67,6 @@ SELECT * FROM t2;
col_int_key pk_1 pk_2 col_int
1 2 3 4
DROP TABLE t1,t2;
#
# end of 5.5 tests
#
mysql-test/t/derived.test
View file @
1d4ac3d4
# Initialize
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
t3
;
--
enable_warnings
set
@
save_derived_optimizer_switch
=@@
optimizer_switch
;
set
optimizer_switch
=
'derived_merge=off,derived_with_keys=off'
;
...
...
mysql-test/t/multi_update.test
View file @
1d4ac3d4
...
...
@@ -371,7 +371,6 @@ drop table t1, t2;
#
connect
(
root
,
localhost
,
root
,,
test
,
$MASTER_MYPORT
,
$MASTER_MYSOCK
);
connection
root
;
--
disable_warnings
create
database
mysqltest
;
--
enable_warnings
...
...
@@ -381,7 +380,6 @@ create table mysqltest.t3 (a int, b int, primary key (a));
grant
select
on
mysqltest
.*
to
mysqltest_1
@
localhost
;
grant
update
on
mysqltest
.
t1
to
mysqltest_1
@
localhost
;
connect
(
user1
,
localhost
,
mysqltest_1
,,
mysqltest
,
$MASTER_MYPORT
,
$MASTER_MYSOCK
);
connection
user1
;
update
t1
,
t2
set
t1
.
b
=
1
where
t1
.
a
=
t2
.
a
;
update
t1
,
t2
set
t1
.
b
=
(
select
t3
.
b
from
t3
where
t1
.
a
=
t3
.
a
)
where
t1
.
a
=
t2
.
a
;
connection
root
;
...
...
@@ -494,15 +492,12 @@ insert into t2 values (10), (20), (30);
create
view
v1
as
select
a
as
b
,
a
/
10
as
a
from
t2
;
connect
(
locker
,
localhost
,
root
,,
test
);
connection
locker
;
lock
table
t1
write
;
connect
(
changer
,
localhost
,
root
,,
test
);
connection
changer
;
send
alter
table
t1
add
column
c
int
default
100
after
a
;
connect
(
updater
,
localhost
,
root
,,
test
);
connection
updater
;
# Wait till "alter table t1 ..." of session changer is in work.
# = There is one session waiting.
let
$wait_condition
=
select
count
(
*
)
=
1
from
information_schema
.
processlist
...
...
@@ -1086,5 +1081,7 @@ select * from t2;
drop
table
t1
,
t2
,
t3
;
drop
user
foo
;
--
echo
end
of
5.5
tests
--
echo
#
--
echo
# end of 5.5 tests
--
echo
#
mysql-test/t/multi_update_innodb.test
View file @
1d4ac3d4
...
...
@@ -75,3 +75,7 @@ UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# end of 5.5 tests
--
echo
#
sql/sql_base.cc
View file @
1d4ac3d4
...
...
@@ -5003,8 +5003,7 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start,
@retval TRUE Error, reported.
*/
bool
open_tables
(
THD
*
thd
,
TABLE_LIST
**
start
,
uint
*
counter
,
Sroutine_hash_entry
**
sroutine_to_open_list
,
uint
flags
,
bool
open_tables
(
THD
*
thd
,
TABLE_LIST
**
start
,
uint
*
counter
,
uint
flags
,
Prelocking_strategy
*
prelocking_strategy
)
{
/*
...
...
@@ -5053,7 +5052,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter,
has_prelocking_list
=
thd
->
lex
->
requires_prelocking
();
table_to_open
=
start
;
sroutine_to_open
=
sroutine_to_open_li
st
;
sroutine_to_open
=
&
thd
->
lex
->
sroutines_list
.
fir
st
;
*
counter
=
0
;
thd_proc_info
(
thd
,
"Opening tables"
);
...
...
@@ -5112,8 +5111,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter,
elements in prelocking list/set.
*/
while
(
*
table_to_open
||
(
thd
->
locked_tables_mode
<=
LTM_LOCK_TABLES
&&
*
sroutine_to_open
))
(
thd
->
locked_tables_mode
<=
LTM_LOCK_TABLES
&&
*
sroutine_to_open
))
{
/*
For every table in the list of tables to open, try to find or open
...
...
sql/sql_base.h
View file @
1d4ac3d4
...
...
@@ -276,8 +276,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
bool
lock_table_names
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
TABLE_LIST
*
table_list_end
,
ulong
lock_wait_timeout
,
uint
flags
);
bool
open_tables
(
THD
*
thd
,
TABLE_LIST
**
tables
,
uint
*
counter
,
Sroutine_hash_entry
**
sroutine_to_open
,
uint
flags
,
bool
open_tables
(
THD
*
thd
,
TABLE_LIST
**
tables
,
uint
*
counter
,
uint
flags
,
Prelocking_strategy
*
prelocking_strategy
);
/* open_and_lock_tables with optional derived handling */
bool
open_and_lock_tables
(
THD
*
thd
,
TABLE_LIST
*
tables
,
...
...
@@ -499,15 +498,6 @@ class Alter_table_prelocking_strategy : public Prelocking_strategy
};
inline
bool
open_tables
(
THD
*
thd
,
TABLE_LIST
**
tables
,
uint
*
counter
,
uint
flags
,
Prelocking_strategy
*
prelocking_strategy
)
{
return
open_tables
(
thd
,
tables
,
counter
,
&
thd
->
lex
->
sroutines_list
.
first
,
flags
,
prelocking_strategy
);
}
inline
bool
open_tables
(
THD
*
thd
,
TABLE_LIST
**
tables
,
uint
*
counter
,
uint
flags
)
{
...
...
sql/sql_update.cc
View file @
1d4ac3d4
...
...
@@ -1251,9 +1251,8 @@ int mysql_multi_update_prepare(THD *thd)
if
(
setup_tables_and_check_access
(
thd
,
&
lex
->
select_lex
.
context
,
&
lex
->
select_lex
.
top_join_list
,
table_list
,
lex
->
select_lex
.
leaf_tables
,
FALSE
,
UPDATE_ACL
,
SELECT_ACL
,
FALSE
))
table_list
,
lex
->
select_lex
.
leaf_tables
,
FALSE
,
UPDATE_ACL
,
SELECT_ACL
,
FALSE
))
DBUG_RETURN
(
TRUE
);
if
(
lex
->
select_lex
.
handle_derived
(
thd
->
lex
,
DT_MERGE
))
...
...
@@ -1272,9 +1271,7 @@ int mysql_multi_update_prepare(THD *thd)
}
if
(
update_view
&&
check_fields
(
thd
,
*
fields
))
{
DBUG_RETURN
(
TRUE
);
}
thd
->
table_map_for_update
=
tables_for_update
=
get_table_map
(
fields
);
...
...
@@ -1293,8 +1290,7 @@ int mysql_multi_update_prepare(THD *thd)
TABLE
*
table
=
tl
->
table
;
/* Only set timestamp column if this is not modified */
if
(
table
->
timestamp_field
&&
bitmap_is_set
(
table
->
write_set
,
table
->
timestamp_field
->
field_index
))
bitmap_is_set
(
table
->
write_set
,
table
->
timestamp_field
->
field_index
))
table
->
timestamp_field_type
=
TIMESTAMP_NO_AUTO_SET
;
/* if table will be updated then check that it is unique */
...
...
@@ -1355,10 +1351,8 @@ int mysql_multi_update_prepare(THD *thd)
if
(
!
tl
->
is_derived
())
{
uint
want_privilege
=
tl
->
updating
?
UPDATE_ACL
:
SELECT_ACL
;
if
(
check_access
(
thd
,
want_privilege
,
tl
->
db
,
&
tl
->
grant
.
privilege
,
&
tl
->
grant
.
m_internal
,
0
,
0
)
||
if
(
check_access
(
thd
,
want_privilege
,
tl
->
db
,
&
tl
->
grant
.
privilege
,
&
tl
->
grant
.
m_internal
,
0
,
0
)
||
check_grant
(
thd
,
want_privilege
,
tl
,
FALSE
,
1
,
FALSE
))
DBUG_RETURN
(
TRUE
);
}
...
...
@@ -1434,25 +1428,18 @@ int mysql_multi_update_prepare(THD *thd)
Setup multi-update handling and call SELECT to do the join
*/
bool
mysql_multi_update
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
List
<
Item
>
*
fields
,
List
<
Item
>
*
values
,
COND
*
conds
,
ulonglong
options
,
bool
mysql_multi_update
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
List
<
Item
>
*
fields
,
List
<
Item
>
*
values
,
COND
*
conds
,
ulonglong
options
,
enum
enum_duplicates
handle_duplicates
,
bool
ignore
,
SELECT_LEX_UNIT
*
unit
,
SELECT_LEX
*
select_lex
,
multi_update
**
result
)
bool
ignore
,
SELECT_LEX_UNIT
*
unit
,
SELECT_LEX
*
select_lex
,
multi_update
**
result
)
{
bool
res
;
DBUG_ENTER
(
"mysql_multi_update"
);
if
(
!
(
*
result
=
new
multi_update
(
table_list
,
&
thd
->
lex
->
select_lex
.
leaf_tables
,
fields
,
values
,
handle_duplicates
,
ignore
)))
fields
,
values
,
handle_duplicates
,
ignore
)))
{
DBUG_RETURN
(
TRUE
);
}
...
...
@@ -1463,11 +1450,9 @@ bool mysql_multi_update(THD *thd,
List
<
Item
>
total_list
;
res
=
mysql_select
(
thd
,
&
select_lex
->
ref_pointer_array
,
table_list
,
select_lex
->
with_wild
,
total_list
,
conds
,
0
,
(
ORDER
*
)
NULL
,
(
ORDER
*
)
NULL
,
(
Item
*
)
NULL
,
(
ORDER
*
)
NULL
,
res
=
mysql_select
(
thd
,
&
select_lex
->
ref_pointer_array
,
table_list
,
select_lex
->
with_wild
,
total_list
,
conds
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
options
|
SELECT_NO_JOIN_CACHE
|
SELECT_NO_UNLOCK
|
OPTION_SETUP_TABLES_DONE
,
*
result
,
unit
,
select_lex
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment