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
3a7f2879
Commit
3a7f2879
authored
Nov 30, 2011
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge the fix of bug lp:825051
parents
264aaf11
625cdb80
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
147 additions
and
1 deletion
+147
-1
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+26
-0
mysql-test/r/subselect_no_mat.result
mysql-test/r/subselect_no_mat.result
+26
-0
mysql-test/r/subselect_no_opts.result
mysql-test/r/subselect_no_opts.result
+26
-0
mysql-test/r/subselect_no_scache.result
mysql-test/r/subselect_no_scache.result
+26
-0
mysql-test/r/subselect_no_semijoin.result
mysql-test/r/subselect_no_semijoin.result
+26
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+16
-0
sql/item.cc
sql/item.cc
+1
-1
No files found.
mysql-test/r/subselect.result
View file @
3a7f2879
...
@@ -5842,5 +5842,31 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
...
@@ -5842,5 +5842,31 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
NULL
NULL
drop tables t1,t2,t3;
drop tables t1,t2,t3;
#
# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
#
CREATE TABLE t1 (a date, KEY (a)) ;
INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
set @old_optimizer_switch = @@optimizer_switch;
SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 4 NULL 1 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 SUBQUERY t1 index NULL a 4 NULL 2 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
set @@optimizer_switch=@old_optimizer_switch;
drop table t1;
# return optimizer switch changed in the beginning of this test
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=@subselect_tmp;
mysql-test/r/subselect_no_mat.result
View file @
3a7f2879
...
@@ -5841,6 +5841,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
...
@@ -5841,6 +5841,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
NULL
NULL
drop tables t1,t2,t3;
drop tables t1,t2,t3;
#
# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
#
CREATE TABLE t1 (a date, KEY (a)) ;
INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
set @old_optimizer_switch = @@optimizer_switch;
SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 4 NULL 1 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 SUBQUERY t1 index NULL a 4 NULL 2 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
set @@optimizer_switch=@old_optimizer_switch;
drop table t1;
# return optimizer switch changed in the beginning of this test
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;
set optimizer_switch=default;
...
...
mysql-test/r/subselect_no_opts.result
View file @
3a7f2879
...
@@ -5837,6 +5837,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
...
@@ -5837,6 +5837,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
NULL
NULL
drop tables t1,t2,t3;
drop tables t1,t2,t3;
#
# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
#
CREATE TABLE t1 (a date, KEY (a)) ;
INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
set @old_optimizer_switch = @@optimizer_switch;
SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 4 NULL 1 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 SUBQUERY t1 index NULL a 4 NULL 2 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
set @@optimizer_switch=@old_optimizer_switch;
drop table t1;
# return optimizer switch changed in the beginning of this test
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;
set @optimizer_switch_for_subselect_test=null;
mysql-test/r/subselect_no_scache.result
View file @
3a7f2879
...
@@ -5846,6 +5846,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
...
@@ -5846,6 +5846,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
NULL
NULL
drop tables t1,t2,t3;
drop tables t1,t2,t3;
#
# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
#
CREATE TABLE t1 (a date, KEY (a)) ;
INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
set @old_optimizer_switch = @@optimizer_switch;
SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 4 NULL 1 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 SUBQUERY t1 index NULL a 4 NULL 2 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
set @@optimizer_switch=@old_optimizer_switch;
drop table t1;
# return optimizer switch changed in the beginning of this test
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;
set optimizer_switch=default;
...
...
mysql-test/r/subselect_no_semijoin.result
View file @
3a7f2879
...
@@ -5837,6 +5837,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
...
@@ -5837,6 +5837,32 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
NULL
NULL
drop tables t1,t2,t3;
drop tables t1,t2,t3;
#
# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
#
CREATE TABLE t1 (a date, KEY (a)) ;
INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
set @old_optimizer_switch = @@optimizer_switch;
SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 4 NULL 1 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 SUBQUERY t1 index NULL a 4 NULL 2 Using index
SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
a
2009-01-01
2009-02-02
set @@optimizer_switch=@old_optimizer_switch;
drop table t1;
# return optimizer switch changed in the beginning of this test
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;
set @optimizer_switch_for_subselect_test=null;
mysql-test/t/subselect.test
View file @
3a7f2879
...
@@ -4916,5 +4916,21 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
...
@@ -4916,5 +4916,21 @@ SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
drop
tables
t1
,
t2
,
t3
;
drop
tables
t1
,
t2
,
t3
;
--
echo
#
--
echo
# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
--
echo
#
CREATE
TABLE
t1
(
a
date
,
KEY
(
a
))
;
INSERT
INTO
t1
VALUES
(
'2009-01-01'
),(
'2009-02-02'
);
set
@
old_optimizer_switch
=
@@
optimizer_switch
;
SET
@@
optimizer_switch
=
'semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
a
IN
(
SELECT
a
AS
field1
FROM
t1
GROUP
BY
field1
);
SELECT
*
FROM
t1
WHERE
a
IN
(
SELECT
a
AS
field1
FROM
t1
GROUP
BY
field1
);
SET
@@
optimizer_switch
=
'semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
a
IN
(
SELECT
a
AS
field1
FROM
t1
GROUP
BY
field1
);
SELECT
*
FROM
t1
WHERE
a
IN
(
SELECT
a
AS
field1
FROM
t1
GROUP
BY
field1
);
set
@@
optimizer_switch
=@
old_optimizer_switch
;
drop
table
t1
;
--
echo
# return optimizer switch changed in the beginning of this test
--
echo
# return optimizer switch changed in the beginning of this test
set
optimizer_switch
=@
subselect_tmp
;
set
optimizer_switch
=@
subselect_tmp
;
sql/item.cc
View file @
3a7f2879
...
@@ -3864,7 +3864,7 @@ String* Item_ref_null_helper::val_str(String* s)
...
@@ -3864,7 +3864,7 @@ String* Item_ref_null_helper::val_str(String* s)
bool
Item_ref_null_helper
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzydate
)
bool
Item_ref_null_helper
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzydate
)
{
{
return
(
owner
->
was_null
|=
null_value
=
(
*
ref
)
->
get_date
(
ltime
,
fuzzydate
));
return
(
owner
->
was_null
|=
null_value
=
(
*
ref
)
->
get_date
_result
(
ltime
,
fuzzydate
));
}
}
...
...
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