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
f17079fa
Commit
f17079fa
authored
Feb 10, 2014
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.3->5.5
parents
41fd4844
3845a89b
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
157 additions
and
5 deletions
+157
-5
mysql-test/r/subselect4.result
mysql-test/r/subselect4.result
+27
-0
mysql-test/r/subselect_sj2.result
mysql-test/r/subselect_sj2.result
+17
-0
mysql-test/r/subselect_sj2_jcl6.result
mysql-test/r/subselect_sj2_jcl6.result
+17
-0
mysql-test/r/subselect_sj2_mat.result
mysql-test/r/subselect_sj2_mat.result
+17
-0
mysql-test/suite/vcol/r/vcol_misc.result
mysql-test/suite/vcol/r/vcol_misc.result
+5
-0
mysql-test/suite/vcol/t/vcol_misc.test
mysql-test/suite/vcol/t/vcol_misc.test
+7
-0
mysql-test/t/subselect4.test
mysql-test/t/subselect4.test
+35
-0
mysql-test/t/subselect_sj2.test
mysql-test/t/subselect_sj2.test
+18
-0
sql/item.h
sql/item.h
+5
-1
sql/opt_subselect.cc
sql/opt_subselect.cc
+6
-2
sql/opt_subselect.h
sql/opt_subselect.h
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-1
No files found.
mysql-test/r/subselect4.result
View file @
f17079fa
...
...
@@ -2317,6 +2317,33 @@ WHERE a='r' AND (c,b) NOT IN (SELECT c,b FROM t2 WHERE (c,b)=(t.c,t.b));
a b c d
DROP TABLE t1, t2;
#
# MDEV-5468: assertion failure with a simplified condition in subselect
#
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1);
CREATE TABLE t2 ( pk int PRIMARY KEY, c INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4), (2,6);
SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq,
COUNT( DISTINCT from_sq.c )
FROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq
GROUP BY select_sq ;
select_sq COUNT( DISTINCT from_sq.c )
1 2
DROP TABLE t1,t2;
CREATE TABLE t1 (id int, a2 char(2), a3 char(3)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'BE','BEL');
CREATE TABLE t2 (id int, a2 char(2), a3 char(3)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'BE','BEL'), (2,'MX','MEX');
CREATE VIEW v2 AS SELECT DISTINCT * FROM t2;
SELECT * FROM t1 AS outer_t1, v2
WHERE v2.a3 = outer_t1.a3
AND EXISTS ( SELECT * FROM t1 WHERE a2 < v2.a2 AND id = outer_t1.id )
AND outer_t1.a3 < 'J'
ORDER BY v2.id;
id a2 a3 id a2 a3
DROP VIEW v2;
DROP TABLE t1,t2;
#
# MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
...
...
mysql-test/r/subselect_sj2.result
View file @
f17079fa
...
...
@@ -1109,6 +1109,23 @@ t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
);
i1
DROP TABLE t1,t2,t3;
#
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT) engine=innodb;
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
INSERT INTO t2 VALUES (4),(5);
explain
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
a
DROP TABLE t1,t2,t3;
DROP TABLE IF EXISTS t1,t2,t3,t4;
#
# MDEV-4782: Valgrind warnings (Conditional jump or move depends on uninitialised value) with InnoDB, semijoin
...
...
mysql-test/r/subselect_sj2_jcl6.result
View file @
f17079fa
...
...
@@ -1124,6 +1124,23 @@ t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
);
i1
DROP TABLE t1,t2,t3;
#
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT) engine=innodb;
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
INSERT INTO t2 VALUES (4),(5);
explain
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
a
DROP TABLE t1,t2,t3;
DROP TABLE IF EXISTS t1,t2,t3,t4;
#
# MDEV-4782: Valgrind warnings (Conditional jump or move depends on uninitialised value) with InnoDB, semijoin
...
...
mysql-test/r/subselect_sj2_mat.result
View file @
f17079fa
...
...
@@ -1111,6 +1111,23 @@ t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
);
i1
DROP TABLE t1,t2,t3;
#
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (8),(9);
CREATE TABLE t2 (b INT) engine=innodb;
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
INSERT INTO t2 VALUES (4),(5);
explain
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
a
DROP TABLE t1,t2,t3;
DROP TABLE IF EXISTS t1,t2,t3,t4;
#
# MDEV-4782: Valgrind warnings (Conditional jump or move depends on uninitialised value) with InnoDB, semijoin
...
...
mysql-test/suite/vcol/r/vcol_misc.result
View file @
f17079fa
...
...
@@ -316,4 +316,9 @@ ERROR HY000: The value specified for computed column 'd' in table 't1' ignored
INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,'a');
ERROR HY000: The value specified for computed column 'd' in table 't1' ignored
drop table t1;
#
# MDEV-5611: self-referencing virtual column
#
create table t1 (a int, b int as (b is null) virtual);
ERROR HY000: A computed column cannot be based on a computed column
# end of 5.3 tests
mysql-test/suite/vcol/t/vcol_misc.test
View file @
f17079fa
...
...
@@ -275,4 +275,11 @@ UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a
INSERT
INTO
`test`
.
`t1`
(
`a`
,
`b`
,
`c`
,
`d`
)
VALUES
(
'1'
,
'a'
,
NULL
,
'a'
);
drop
table
t1
;
--
echo
#
--
echo
# MDEV-5611: self-referencing virtual column
--
echo
#
--
error
ER_VCOL_BASED_ON_VCOL
create
table
t1
(
a
int
,
b
int
as
(
b
is
null
)
virtual
);
--
echo
# end of 5.3 tests
mysql-test/t/subselect4.test
View file @
f17079fa
...
...
@@ -1853,6 +1853,41 @@ SELECT * FROM t1 AS t
WHERE
a
=
'r'
AND
(
c
,
b
)
NOT
IN
(
SELECT
c
,
b
FROM
t2
WHERE
(
c
,
b
)
=
(
t
.
c
,
t
.
b
));
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-5468: assertion failure with a simplified condition in subselect
--
echo
#
CREATE
TABLE
t1
(
a
int
,
b
int
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
,
1
);
CREATE
TABLE
t2
(
pk
int
PRIMARY
KEY
,
c
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
1
,
4
),
(
2
,
6
);
SELECT
(
SELECT
MAX
(
b
)
FROM
t1
,
t2
WHERE
pk
=
a
AND
b
<
from_sq
.
c
)
AS
select_sq
,
COUNT
(
DISTINCT
from_sq
.
c
)
FROM
(
SELECT
DISTINCT
t2_1
.*
FROM
t2
AS
t2_1
,
t2
AS
t2_2
)
AS
from_sq
GROUP
BY
select_sq
;
DROP
TABLE
t1
,
t2
;
CREATE
TABLE
t1
(
id
int
,
a2
char
(
2
),
a3
char
(
3
))
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
,
'BE'
,
'BEL'
);
CREATE
TABLE
t2
(
id
int
,
a2
char
(
2
),
a3
char
(
3
))
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
1
,
'BE'
,
'BEL'
),
(
2
,
'MX'
,
'MEX'
);
CREATE
VIEW
v2
AS
SELECT
DISTINCT
*
FROM
t2
;
SELECT
*
FROM
t1
AS
outer_t1
,
v2
WHERE
v2
.
a3
=
outer_t1
.
a3
AND
EXISTS
(
SELECT
*
FROM
t1
WHERE
a2
<
v2
.
a2
AND
id
=
outer_t1
.
id
)
AND
outer_t1
.
a3
<
'J'
ORDER
BY
v2
.
id
;
DROP
VIEW
v2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
--
echo
#
...
...
mysql-test/t/subselect_sj2.test
View file @
f17079fa
...
...
@@ -1245,6 +1245,24 @@ SELECT * FROM t1 WHERE ( 1, 1 ) IN (
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
engine
=
innodb
;
INSERT
INTO
t1
VALUES
(
8
),(
9
);
CREATE
TABLE
t2
(
b
INT
)
engine
=
innodb
;
INSERT
INTO
t2
VALUES
(
2
),(
3
);
CREATE
TABLE
t3
(
c
INT
,
INDEX
(
c
))
engine
=
innodb
;
INSERT
INTO
t2
VALUES
(
4
),(
5
);
explain
SELECT
*
FROM
t1
WHERE
9
IN
(
SELECT
b
FROM
t2
WHERE
1
IN
(
SELECT
MIN
(
c
)
FROM
t3
)
);
SELECT
*
FROM
t1
WHERE
9
IN
(
SELECT
b
FROM
t2
WHERE
1
IN
(
SELECT
MIN
(
c
)
FROM
t3
)
);
DROP
TABLE
t1
,
t2
,
t3
;
--
source
include
/
have_innodb
.
inc
--
disable_warnings
...
...
sql/item.h
View file @
f17079fa
...
...
@@ -2073,7 +2073,11 @@ public:
tab
->
merge_keys
.
merge
(
field
->
part_of_key
);
if
(
tab
->
read_set
)
bitmap_fast_test_and_set
(
tab
->
read_set
,
field
->
field_index
);
if
(
field
->
vcol_info
)
/*
Do not mark a self-referecing virtual column.
Such virtual columns are reported as invalid.
*/
if
(
field
->
vcol_info
&&
tab
->
vcol_set
)
tab
->
mark_virtual_col
(
field
);
}
}
...
...
sql/opt_subselect.cc
View file @
f17079fa
...
...
@@ -5306,9 +5306,9 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
through Item::cleanup() calls).
*/
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
)
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
)
{
List_iterator
<
TABLE_LIST
>
li
(
*
join
->
join
_list
);
List_iterator
<
TABLE_LIST
>
li
(
*
join_list
);
TABLE_LIST
*
table
;
while
((
table
=
li
++
))
{
...
...
@@ -5320,6 +5320,10 @@ void cleanup_empty_jtbm_semi_joins(JOIN *join)
table
->
table
=
NULL
;
}
}
else
if
(
table
->
nested_join
&&
table
->
sj_subq_pred
)
{
cleanup_empty_jtbm_semi_joins
(
join
,
&
table
->
nested_join
->
join_list
);
}
}
}
...
...
sql/opt_subselect.h
View file @
f17079fa
...
...
@@ -28,7 +28,7 @@ int pull_out_semijoin_tables(JOIN *join);
bool
optimize_semijoin_nests
(
JOIN
*
join
,
table_map
all_table_map
);
bool
setup_jtbm_semi_joins
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
,
Item
**
join_where
);
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
);
void
cleanup_empty_jtbm_semi_joins
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
);
// used by Loose_scan_opt
ulonglong
get_bound_sj_equalities
(
TABLE_LIST
*
sj_nest
,
...
...
sql/sql_select.cc
View file @
f17079fa
...
...
@@ -3610,6 +3610,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if
(
conds
&&
const_count
)
{
conds
=
remove_eq_conds
(
join
->
thd
,
conds
,
&
join
->
cond_value
);
join
->
select_lex
->
where
=
conds
;
if
(
join
->
cond_value
==
Item
::
COND_FALSE
)
{
join
->
impossible_where
=
true
;
...
...
@@ -10848,7 +10849,7 @@ void JOIN::cleanup(bool full)
}
if
(
full
)
{
cleanup_empty_jtbm_semi_joins
(
this
);
cleanup_empty_jtbm_semi_joins
(
this
,
join_list
);
/*
Ensure that the following delete_elements() would not be called
twice for the same list.
...
...
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