summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/case.result8
-rw-r--r--mysql-test/r/func_group_innodb.result27
-rw-r--r--mysql-test/r/ps.result106
-rw-r--r--mysql-test/r/sp.result7
-rw-r--r--mysql-test/r/subselect.result30
-rw-r--r--mysql-test/r/subselect_no_mat.result30
-rw-r--r--mysql-test/r/subselect_no_opts.result30
-rw-r--r--mysql-test/r/subselect_no_scache.result30
-rw-r--r--mysql-test/r/subselect_no_semijoin.result30
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14007649.test4
-rw-r--r--mysql-test/t/case.test19
-rw-r--r--mysql-test/t/func_group_innodb.test29
-rw-r--r--mysql-test/t/ps.test92
-rw-r--r--mysql-test/t/sp.test9
-rw-r--r--mysql-test/t/subselect.test25
-rw-r--r--sql/item_subselect.cc28
-rw-r--r--sql/log.h2
-rw-r--r--sql/log_event.h10
-rw-r--r--sql/rpl_utility.cc7
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_repl.cc2
-rw-r--r--sql/sql_select.cc4
-rw-r--r--sql/sql_union.cc2
-rw-r--r--win/packaging/ca/CMakeLists.txt2
24 files changed, 261 insertions, 273 deletions
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index eb6ce7d1752..3852da5d4b0 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -220,6 +220,10 @@ a d
3 11120436154190595086
drop table t1, t2;
End of 5.0 tests
+CREATE TABLE t1(a YEAR);
+SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
+1
+DROP TABLE t1;
create table t1 (f1 time);
insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;
@@ -227,7 +231,3 @@ case t1.f1 when '00:00:00' then 1 end
1
NULL
drop table t1;
-CREATE TABLE t1(a YEAR);
-SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
-1
-DROP TABLE t1;
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index 6485793d0e1..67ea44f187a 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -146,19 +146,6 @@ count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
#
-# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
-#
-CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
-KEY(b, c, a(765))) ENGINE=INNODB;
-INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
-SELECT MIN(c) FROM t1 GROUP BY b;
-MIN(c)
-0
-EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by
-DROP TABLE t1;
-#
# Bug #57954: BIT_AND function returns incorrect results when
# semijoin=on
CREATE TABLE c (
@@ -230,4 +217,18 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
member_id_to COUNT(*)
518491 2
DROP TABLE t1;
+# End of test BUG#12713907
+#
+# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+#
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
+SELECT MIN(c) FROM t1 GROUP BY b;
+MIN(c)
+0
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by
+DROP TABLE t1;
End of 5.5 tests
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 7629775b892..95217d9716a 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3056,7 +3056,7 @@ DROP TABLE t1;
End of 5.1 tests.
#
-# LP bug#1001500 Crash on the second execution of the PS for
+# lp:1001500 Crash on the second execution of the PS for
# a query with degenerated conjunctive condition
# (see also mysql bug#12582849)
#
@@ -3996,108 +3996,4 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
deallocate prepare st;
drop table t1;
-#
-# LP bug#993459 Execution of PS for a query with GROUP BY
-# returns wrong result (see also mysql bug#13805127)
-#
-PREPARE s1 FROM
-"
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2
-";
-
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
-(
-SELECT 3 as c2 FROM dual WHERE @x = 1
-UNION
-SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
-) AS t1,
-(
-SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
-UNION
-SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
-UNION
-SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
-) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
-c1 c2 count(c3)
-2012-03-01 01:00:00 3 1
-2012-03-01 01:99345900:00 2 1
-2012-03-01 02:00:00 3 1
-
-EXECUTE s1;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-2012-03-01 01:00:00 3 1
-2012-03-01 02:00:00 3 1
-
-SET @x = 2;
-SELECT c1, t2.c2, count(c3)
-FROM
-(
-SELECT 3 as c2 FROM dual WHERE @x = 1
-UNION
-SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
-) AS t1,
-(
-SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
-UNION
-SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
-UNION
-SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
-) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-
-EXECUTE s1;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
-(
-SELECT 3 as c2 FROM dual WHERE @x = 1
-UNION
-SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
-) AS t1,
-(
-SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
-UNION
-SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
-UNION
-SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
-) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-2012-03-01 01:00:00 3 1
-2012-03-01 02:00:00 3 1
-
-EXECUTE s1;
-c1 c2 count(c3)
-2012-03-01 01:00:00 2 1
-2012-03-01 01:00:00 3 1
-2012-03-01 02:00:00 3 1
-DEALLOCATE PREPARE s1;
# End of 5.3 tests
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 414eeada0de..b5e6e84a49a 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7811,9 +7811,12 @@ DROP FUNCTION f1;
# -- End of 5.1 tests
# ------------------------------------------------------------------
#
-# LP bug#993459 Execution of PS for a query with GROUP BY
+# lp:993459 Execution of PS for a query with GROUP BY
# returns wrong result (see also mysql bug#13805127)
#
+
+# Bug#13805127: Stored program cache produces wrong result in same THD
+
CREATE PROCEDURE p1(x INT UNSIGNED)
BEGIN
SELECT c1, t2.c2, count(c3)
@@ -7850,7 +7853,7 @@ c1 c2 count(c3)
2012-03-01 02:00:00 3 1
DROP PROCEDURE p1;
#
-# LP bug#1002157 : testing stored function
+# lp:1002157 : testing stored function
# bug#62125 result for null incorrectly yields 1292 warning.
#
DROP FUNCTION IF EXISTS f1;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 8c71c09c1ac..acb1b7266ec 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -6612,7 +6612,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6806,5 +6832,3 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 48ab96dcaaa..87402a23a99 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -6611,7 +6611,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6804,8 +6830,6 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 9ab4e23b091..c63c14da5bd 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -6607,7 +6607,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6801,6 +6827,4 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index d47aa956ead..22a897bc7dd 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -6618,7 +6618,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6812,8 +6838,6 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 96e6c2182fa..e501129f7f6 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -6607,7 +6607,33 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
min_a a
drop table t1;
#
-# LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization
#
CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
@@ -6801,7 +6827,5 @@ Table_schema Table_name Index_name Rows_read
test t2 b 1
set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
-# return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14007649.test b/mysql-test/suite/innodb/t/innodb_bug14007649.test
index 5f613cad6f1..da413e0ce59 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14007649.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14007649.test
@@ -1,9 +1,9 @@
--source include/have_innodb.inc
--source include/have_debug.inc
-if (`select plugin_auth_version <= "1.1.8-26.0" from information_schema.plugins where plugin_name='innodb'`)
+if (`select plugin_auth_version <= "1.0.17-13.01" from information_schema.plugins where plugin_name='innodb'`)
{
- --skip Not fixed in XtraDB 1.1.8-26.0 or earlier
+ --skip Not fixed in XtraDB 1.0.17-13.01 or earlier
}
create table t1 (
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 69a4cb71430..f536f556780 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -175,6 +175,16 @@ drop table t1, t2;
--echo End of 5.0 tests
#
+# lp:1001510
+# Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
+# ELSE CLAUSE
+#
+
+CREATE TABLE t1(a YEAR);
+SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
+DROP TABLE t1;
+
+#
# lp:839387 Assertion `(Item_result)i != TIME_RESULT' failed with CASE + datetime
#
@@ -183,12 +193,3 @@ insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;
drop table t1;
-#
-# LP BUG#1001510
-# Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
-# ELSE CLAUSE
-#
-
-CREATE TABLE t1(a YEAR);
-SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
-DROP TABLE t1;
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index bfe91f1f587..6706792d162 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -84,20 +84,6 @@ select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
-
---echo #
---echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
---echo #
-
-CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
- KEY(b, c, a(765))) ENGINE=INNODB;
-INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
-
-SELECT MIN(c) FROM t1 GROUP BY b;
-EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
-
-DROP TABLE t1;
-
--echo #
--echo # Bug #57954: BIT_AND function returns incorrect results when
--echo # semijoin=on
@@ -173,4 +159,19 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
DROP TABLE t1;
+--echo # End of test BUG#12713907
+
+--echo #
+--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+--echo #
+
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+ KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
+
+SELECT MIN(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+
+DROP TABLE t1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index d955b46469c..ff28631862c 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3125,7 +3125,7 @@ DROP TABLE t1;
--echo End of 5.1 tests.
--echo #
---echo # LP bug#1001500 Crash on the second execution of the PS for
+--echo # lp:1001500 Crash on the second execution of the PS for
--echo # a query with degenerated conjunctive condition
--echo # (see also mysql bug#12582849)
--echo #
@@ -3572,94 +3572,4 @@ show status like '%Handler_read%';
deallocate prepare st;
drop table t1;
---echo #
---echo # LP bug#993459 Execution of PS for a query with GROUP BY
---echo # returns wrong result (see also mysql bug#13805127)
---echo #
-
-PREPARE s1 FROM
-"
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2
-";
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 2;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
-DEALLOCATE PREPARE s1;
-
--echo # End of 5.3 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 08421040109..2528f0d7b2b 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9111,9 +9111,14 @@ DROP FUNCTION f1;
--echo # ------------------------------------------------------------------
--echo #
---echo # LP bug#993459 Execution of PS for a query with GROUP BY
+--echo # lp:993459 Execution of PS for a query with GROUP BY
--echo # returns wrong result (see also mysql bug#13805127)
--echo #
+
+--echo
+--echo # Bug#13805127: Stored program cache produces wrong result in same THD
+--echo
+
delimiter |;
CREATE PROCEDURE p1(x INT UNSIGNED)
@@ -9147,7 +9152,7 @@ CALL p1(1);
DROP PROCEDURE p1;
--echo #
---echo # LP bug#1002157 : testing stored function
+--echo # lp:1002157 : testing stored function
--echo # bug#62125 result for null incorrectly yields 1292 warning.
--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 786e328aa72..3350b80ed3f 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -5576,7 +5576,28 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
drop table t1;
--echo #
---echo # LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+--echo # MDEV-367: Different results with and without subquery_cache on
+--echo # a query with a constant NOT IN condition
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+
+set @mdev367_optimizer_switch = @@optimizer_switch;
+
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+set optimizer_switch=@mdev367_optimizer_switch;
+
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+set optimizer_switch=@mdev367_optimizer_switch;
+
+DROP TABLE t1;
+
+--echo #
+--echo # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
--echo # precomputed and thus not part of optimization
--echo #
@@ -5721,5 +5742,3 @@ set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
---echo # return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index cedc4ccb834..8bb4e7af00f 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -819,7 +819,9 @@ table_map Item_subselect::used_tables() const
bool Item_subselect::const_item() const
{
- return thd->lex->context_analysis_only ? FALSE : const_item_cache;
+ return (thd->lex->context_analysis_only ?
+ FALSE :
+ forced_const || const_item_cache);
}
Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
@@ -1272,7 +1274,7 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
else
{
reset();
- return 0;
+ return 1;
}
}
@@ -1538,6 +1540,10 @@ double Item_in_subselect::val_real()
*/
DBUG_ASSERT(0);
DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ return value;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1558,6 +1564,10 @@ longlong Item_in_subselect::val_int()
*/
DBUG_ASSERT(0);
DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ return value;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1578,6 +1588,10 @@ String *Item_in_subselect::val_str(String *str)
*/
DBUG_ASSERT(0);
DBUG_ASSERT(fixed == 1);
+ if (forced_const)
+ goto value_is_ready;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1589,6 +1603,7 @@ String *Item_in_subselect::val_str(String *str)
null_value= TRUE;
return 0;
}
+value_is_ready:
str->set((ulonglong)value, &my_charset_bin);
return str;
}
@@ -1599,6 +1614,8 @@ bool Item_in_subselect::val_bool()
DBUG_ASSERT(fixed == 1);
if (forced_const)
return value;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
if (exec())
{
@@ -1617,6 +1634,10 @@ my_decimal *Item_in_subselect::val_decimal(my_decimal *decimal_value)
method should not be used
*/
DBUG_ASSERT(0);
+ if (forced_const)
+ goto value_is_ready;
+ DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ ! engine->is_executed());
null_value= was_null= FALSE;
DBUG_ASSERT(fixed == 1);
if (exec())
@@ -1626,6 +1647,7 @@ my_decimal *Item_in_subselect::val_decimal(my_decimal *decimal_value)
}
if (was_null && !value)
null_value= TRUE;
+value_is_ready:
int2my_decimal(E_DEC_FATAL_ERROR, value, 0, decimal_value);
return decimal_value;
}
@@ -3176,6 +3198,8 @@ int subselect_single_select_engine::exec()
tab->read_record.read_record= tab->save_read_record;
}
executed= 1;
+ if (!(uncacheable() & ~UNCACHEABLE_EXPLAIN))
+ item->make_const();
thd->where= save_where;
thd->lex->current_select= save_select;
DBUG_RETURN(join->error || thd->is_fatal_error || thd->is_error());
diff --git a/sql/log.h b/sql/log.h
index 88352de5418..9b9bed1262a 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -863,7 +863,7 @@ int query_error_code(THD *thd, bool not_killed);
uint purge_log_get_error_code(int res);
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
-void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
+void sql_print_error(const char *format, ...);
void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
diff --git a/sql/log_event.h b/sql/log_event.h
index 00fddf1a821..bf45dd0cc93 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -4295,6 +4295,16 @@ bool event_checksum_test(uchar *buf, ulong event_len, uint8 alg);
uint8 get_checksum_alg(const char* buf, ulong len);
extern TYPELIB binlog_checksum_typelib;
+#ifndef MYSQL_CLIENT
+/**
+ The function is called by slave applier in case there are
+ active table filtering rules to force gathering events associated
+ with Query-log-event into an array to execute
+ them once the fate of the Query is determined for execution.
+*/
+bool slave_execute_deferred_events(THD *thd);
+#endif
+
/**
@} (end of group Replication)
*/
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 388a6c9f9bb..069fac1c3ec 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -15,11 +15,10 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "rpl_utility.h"
+#include "log_event.h"
-#ifndef MYSQL_CLIENT
-#include "unireg.h" // REQUIRED by later includes
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
#include "rpl_rli.h"
-#include "log_event.h"
#include "sql_select.h"
/**
@@ -954,7 +953,6 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
target_table->s->table_name.str);
DBUG_RETURN(conv_table);
}
-
#endif /* MYSQL_CLIENT */
table_def::table_def(unsigned char *types, ulong size,
@@ -1115,7 +1113,6 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
}
-
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 387f1f2de2e..13622cb420a 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -4159,7 +4159,6 @@ bool LEX::is_partition_management() const
alter_info.flags == ALTER_REORGANIZE_PARTITION));
}
-
#ifdef MYSQL_SERVER
uint binlog_unsafe_map[256];
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 268a68c3202..53ac103dda1 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2011, Monty Program Ab
+ Copyright (c) 2008, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8dc00ee710a..01cb12185e4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -11904,9 +11904,9 @@ static int compare_fields_by_table_order(Item *field1,
bool outer_ref= 0;
Item_field *f1= (Item_field *) (field1->real_item());
Item_field *f2= (Item_field *) (field2->real_item());
- if (f1->const_item())
+ if (field1->const_item() || f1->const_item())
return 1;
- if (f2->const_item())
+ if (field2->const_item() || f2->const_item())
return -1;
if (f2->used_tables() & OUTER_REF_TABLE_BIT)
{
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 021267b53bd..8dcae907926 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -621,6 +621,8 @@ bool st_select_lex_unit::exec()
if (executed && !uncacheable && !describe)
DBUG_RETURN(FALSE);
executed= 1;
+ if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
+ item->make_const();
saved_error= optimize();
diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt
index 940e9e3a7d1..0da1e5d67b1 100644
--- a/win/packaging/ca/CMakeLists.txt
+++ b/win/packaging/ca/CMakeLists.txt
@@ -33,7 +33,7 @@ IF(MSVC_VERSION EQUAL 1400)
ELSEIF(MSVC_VERSION EQUAL 1500)
SET(WIX35_MSVC_SUFFIX "_2008")
SET(WIX36_MSVC_SUFFIX "VS2008")
-ELSEIF(MSVC_VERSION EQUAL 1600)
+ELSEIF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
SET(WIX35_MSVC_SUFFIX "_2010")
SET(WIX36_MSVC_SUFFIX "VS2010")
ELSE()