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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
cb925491
Commit
cb925491
authored
Aug 03, 2015
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tmp' into 10.0
parents
4188ba9c
193faa57
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
1 deletion
+121
-1
mysql-test/r/subselect_mat.result
mysql-test/r/subselect_mat.result
+18
-0
mysql-test/r/subselect_sj_mat.result
mysql-test/r/subselect_sj_mat.result
+18
-0
mysql-test/r/view.result
mysql-test/r/view.result
+15
-0
mysql-test/t/subselect_sj_mat.test
mysql-test/t/subselect_sj_mat.test
+25
-0
mysql-test/t/view.test
mysql-test/t/view.test
+21
-0
sql/sql_parse.cc
sql/sql_parse.cc
+4
-0
sql/sql_update.cc
sql/sql_update.cc
+20
-1
No files found.
mysql-test/r/subselect_mat.result
View file @
cb925491
...
@@ -2197,6 +2197,24 @@ Handler_read_rnd_next 6003
...
@@ -2197,6 +2197,24 @@ Handler_read_rnd_next 6003
Handler_tmp_write 2000
Handler_tmp_write 2000
Handler_write 1000
Handler_write 1000
drop table t0,t1,t2,t3;
drop table t0,t1,t2,t3;
#
# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
# on 2nd execution os PS with multi-table update
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT);
INSERT INTO t2 VALUES (3),(4);
CREATE TABLE t3 (f3 INT);
INSERT INTO t3 VALUES (5),(6);
PREPARE stmt FROM '
UPDATE t1, t2
SET f1 = 5
WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
';
EXECUTE stmt;
EXECUTE stmt;
DROP TABLE t1,t2,t3;
set @subselect_mat_test_optimizer_switch_value=null;
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
...
...
mysql-test/r/subselect_sj_mat.result
View file @
cb925491
...
@@ -2237,3 +2237,21 @@ Handler_read_rnd_next 6003
...
@@ -2237,3 +2237,21 @@ Handler_read_rnd_next 6003
Handler_tmp_write 2000
Handler_tmp_write 2000
Handler_write 1000
Handler_write 1000
drop table t0,t1,t2,t3;
drop table t0,t1,t2,t3;
#
# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
# on 2nd execution os PS with multi-table update
#
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT);
INSERT INTO t2 VALUES (3),(4);
CREATE TABLE t3 (f3 INT);
INSERT INTO t3 VALUES (5),(6);
PREPARE stmt FROM '
UPDATE t1, t2
SET f1 = 5
WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
';
EXECUTE stmt;
EXECUTE stmt;
DROP TABLE t1,t2,t3;
mysql-test/r/view.result
View file @
cb925491
...
@@ -5427,6 +5427,21 @@ View Create View character_set_client collation_connection
...
@@ -5427,6 +5427,21 @@ View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
drop view v2;
drop view v2;
drop table t1;
drop table t1;
#
# MDEV-8554: Server crashes in base_list_iterator::next_fast on 1st execution of PS with a multi-table update
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (3),(4);
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 VALUES (5),(6);
CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
PREPARE stmt FROM 'UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM t3 )';
UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
EXECUTE stmt;
DROP TABLE t1, t2, t3;
DROP VIEW v3;
# -----------------------------------------------------------------
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -- End of 5.5 tests.
# -----------------------------------------------------------------
# -----------------------------------------------------------------
...
...
mysql-test/t/subselect_sj_mat.test
View file @
cb925491
...
@@ -1885,3 +1885,28 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b);
...
@@ -1885,3 +1885,28 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b);
show
status
where
Variable_name
like
'Handler_read%'
or
Variable_name
like
'Handler_%write%'
;
show
status
where
Variable_name
like
'Handler_read%'
or
Variable_name
like
'Handler_%write%'
;
drop
table
t0
,
t1
,
t2
,
t3
;
drop
table
t0
,
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
--
echo
# on 2nd execution os PS with multi-table update
--
echo
#
CREATE
TABLE
t1
(
f1
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
TABLE
t2
(
f2
INT
);
INSERT
INTO
t2
VALUES
(
3
),(
4
);
CREATE
TABLE
t3
(
f3
INT
);
INSERT
INTO
t3
VALUES
(
5
),(
6
);
PREPARE
stmt
FROM
'
UPDATE t1, t2
SET f1 = 5
WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
'
;
EXECUTE
stmt
;
EXECUTE
stmt
;
DROP
TABLE
t1
,
t2
,
t3
;
mysql-test/t/view.test
View file @
cb925491
...
@@ -5380,6 +5380,27 @@ show create view v2;
...
@@ -5380,6 +5380,27 @@ show create view v2;
drop
view
v2
;
drop
view
v2
;
drop
table
t1
;
drop
table
t1
;
--
echo
#
--
echo
# MDEV-8554: Server crashes in base_list_iterator::next_fast on 1st execution of PS with a multi-table update
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
),(
2
);
# Not necessary, the table can be empty
CREATE
TABLE
t2
(
b
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
3
),(
4
);
# Not necessary, the table can be empty
CREATE
TABLE
t3
(
c
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t3
VALUES
(
5
),(
6
);
# Not necessary, the table can be empty
CREATE
OR
REPLACE
ALGORITHM
=
MERGE
VIEW
v3
AS
SELECT
*
FROM
t3
;
PREPARE
stmt
FROM
'UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM t3 )'
;
UPDATE
t1
,
t2
SET
a
=
1
WHERE
a
IN
(
SELECT
0
FROM
v3
);
EXECUTE
stmt
;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
VIEW
v3
;
--
echo
# -----------------------------------------------------------------
--
echo
# -----------------------------------------------------------------
--
echo
# -- End of 5.5 tests.
--
echo
# -- End of 5.5 tests.
--
echo
# -----------------------------------------------------------------
--
echo
# -----------------------------------------------------------------
...
...
sql/sql_parse.cc
View file @
cb925491
...
@@ -6269,6 +6269,8 @@ void THD::reset_for_next_command()
...
@@ -6269,6 +6269,8 @@ void THD::reset_for_next_command()
thd
->
reset_current_stmt_binlog_format_row
();
thd
->
reset_current_stmt_binlog_format_row
();
thd
->
binlog_unsafe_warning_flags
=
0
;
thd
->
binlog_unsafe_warning_flags
=
0
;
thd
->
save_prep_leaf_list
=
false
;
DBUG_PRINT
(
"debug"
,
DBUG_PRINT
(
"debug"
,
(
"is_current_stmt_binlog_format_row(): %d"
,
(
"is_current_stmt_binlog_format_row(): %d"
,
thd
->
is_current_stmt_binlog_format_row
()));
thd
->
is_current_stmt_binlog_format_row
()));
...
@@ -7749,6 +7751,8 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
...
@@ -7749,6 +7751,8 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables)
*/
*/
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
{
{
if
(
table
->
is_jtbm
())
continue
;
if
(
table
->
derived
)
if
(
table
->
derived
)
table
->
grant
.
privilege
=
SELECT_ACL
;
table
->
grant
.
privilege
=
SELECT_ACL
;
else
if
((
check_access
(
thd
,
UPDATE_ACL
,
table
->
db
,
else
if
((
check_access
(
thd
,
UPDATE_ACL
,
table
->
db
,
...
...
sql/sql_update.cc
View file @
cb925491
...
@@ -1161,7 +1161,7 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
...
@@ -1161,7 +1161,7 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
while
((
tl
=
it
++
))
while
((
tl
=
it
++
))
{
{
if
(
tl
->
table
->
map
&
tables_for_update
)
if
(
!
tl
->
is_jtbm
()
&&
(
tl
->
table
->
map
&
tables_for_update
)
)
{
{
TABLE
*
table1
=
tl
->
table
;
TABLE
*
table1
=
tl
->
table
;
bool
primkey_clustered
=
(
table1
->
file
->
primary_key_is_clustered
()
&&
bool
primkey_clustered
=
(
table1
->
file
->
primary_key_is_clustered
()
&&
...
@@ -1178,6 +1178,8 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
...
@@ -1178,6 +1178,8 @@ bool unsafe_key_update(List<TABLE_LIST> leaves, table_map tables_for_update)
it2
.
rewind
();
it2
.
rewind
();
while
((
tl2
=
it2
++
))
while
((
tl2
=
it2
++
))
{
{
if
(
tl2
->
is_jtbm
())
continue
;
/*
/*
Look at "next" tables only since all previous tables have
Look at "next" tables only since all previous tables have
already been checked
already been checked
...
@@ -1409,6 +1411,9 @@ int mysql_multi_update_prepare(THD *thd)
...
@@ -1409,6 +1411,9 @@ int mysql_multi_update_prepare(THD *thd)
{
{
TABLE
*
table
=
tl
->
table
;
TABLE
*
table
=
tl
->
table
;
if
(
tl
->
is_jtbm
())
continue
;
/* if table will be updated then check that it is unique */
/* if table will be updated then check that it is unique */
if
(
table
->
map
&
tables_for_update
)
if
(
table
->
map
&
tables_for_update
)
{
{
...
@@ -1457,6 +1462,8 @@ int mysql_multi_update_prepare(THD *thd)
...
@@ -1457,6 +1462,8 @@ int mysql_multi_update_prepare(THD *thd)
for
(
tl
=
table_list
;
tl
;
tl
=
tl
->
next_local
)
for
(
tl
=
table_list
;
tl
;
tl
=
tl
->
next_local
)
{
{
bool
not_used
=
false
;
bool
not_used
=
false
;
if
(
tl
->
is_jtbm
())
continue
;
if
(
multi_update_check_table_access
(
thd
,
tl
,
tables_for_update
,
&
not_used
))
if
(
multi_update_check_table_access
(
thd
,
tl
,
tables_for_update
,
&
not_used
))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
}
...
@@ -1464,6 +1471,8 @@ int mysql_multi_update_prepare(THD *thd)
...
@@ -1464,6 +1471,8 @@ int mysql_multi_update_prepare(THD *thd)
/* check single table update for view compound from several tables */
/* check single table update for view compound from several tables */
for
(
tl
=
table_list
;
tl
;
tl
=
tl
->
next_local
)
for
(
tl
=
table_list
;
tl
;
tl
=
tl
->
next_local
)
{
{
if
(
tl
->
is_jtbm
())
continue
;
if
(
tl
->
is_merged_derived
())
if
(
tl
->
is_merged_derived
())
{
{
TABLE_LIST
*
for_update
=
0
;
TABLE_LIST
*
for_update
=
0
;
...
@@ -1493,6 +1502,8 @@ int mysql_multi_update_prepare(THD *thd)
...
@@ -1493,6 +1502,8 @@ int mysql_multi_update_prepare(THD *thd)
ti
.
rewind
();
ti
.
rewind
();
while
((
tl
=
ti
++
))
while
((
tl
=
ti
++
))
{
{
if
(
tl
->
is_jtbm
())
continue
;
TABLE
*
table
=
tl
->
table
;
TABLE
*
table
=
tl
->
table
;
TABLE_LIST
*
tlist
;
TABLE_LIST
*
tlist
;
if
(
!
(
tlist
=
tl
->
top_table
())
->
derived
)
if
(
!
(
tlist
=
tl
->
top_table
())
->
derived
)
...
@@ -1635,6 +1646,9 @@ int multi_update::prepare(List<Item> ¬_used_values,
...
@@ -1635,6 +1646,9 @@ int multi_update::prepare(List<Item> ¬_used_values,
*/
*/
while
((
table_ref
=
ti
++
))
while
((
table_ref
=
ti
++
))
{
{
if
(
table_ref
->
is_jtbm
())
continue
;
TABLE
*
table
=
table_ref
->
table
;
TABLE
*
table
=
table_ref
->
table
;
if
(
tables_to_update
&
table
->
map
)
if
(
tables_to_update
&
table
->
map
)
{
{
...
@@ -1654,6 +1668,9 @@ int multi_update::prepare(List<Item> ¬_used_values,
...
@@ -1654,6 +1668,9 @@ int multi_update::prepare(List<Item> ¬_used_values,
ti
.
rewind
();
ti
.
rewind
();
while
((
table_ref
=
ti
++
))
while
((
table_ref
=
ti
++
))
{
{
if
(
table_ref
->
is_jtbm
())
continue
;
TABLE
*
table
=
table_ref
->
table
;
TABLE
*
table
=
table_ref
->
table
;
if
(
tables_to_update
&
table
->
map
)
if
(
tables_to_update
&
table
->
map
)
{
{
...
@@ -1684,6 +1701,8 @@ int multi_update::prepare(List<Item> ¬_used_values,
...
@@ -1684,6 +1701,8 @@ int multi_update::prepare(List<Item> ¬_used_values,
while
((
table_ref
=
ti
++
))
while
((
table_ref
=
ti
++
))
{
{
/* TODO: add support of view of join support */
/* TODO: add support of view of join support */
if
(
table_ref
->
is_jtbm
())
continue
;
TABLE
*
table
=
table_ref
->
table
;
TABLE
*
table
=
table_ref
->
table
;
leaf_table_count
++
;
leaf_table_count
++
;
if
(
tables_to_update
&
table
->
map
)
if
(
tables_to_update
&
table
->
map
)
...
...
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