summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/archive.result12
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/ctype_binary.result1
-rw-r--r--mysql-test/r/ctype_cp1251.result1
-rw-r--r--mysql-test/r/ctype_latin1.result1
-rw-r--r--mysql-test/r/ctype_ucs.result8
-rw-r--r--mysql-test/r/ctype_utf16.result1
-rw-r--r--mysql-test/r/ctype_utf32.result1
-rw-r--r--mysql-test/r/ctype_utf8.result2
-rw-r--r--mysql-test/r/func_math.result4
-rw-r--r--mysql-test/r/grant.result6
-rw-r--r--mysql-test/r/index_merge_innodb.result38
-rw-r--r--mysql-test/r/information_schema.result14
-rw-r--r--mysql-test/r/innodb-lock.result57
-rw-r--r--mysql-test/r/innodb-semi-consistent.result47
-rw-r--r--mysql-test/r/innodb-zip.result421
-rw-r--r--mysql-test/r/innodb.result3305
-rw-r--r--mysql-test/r/innodb_bug36172.result1
-rw-r--r--mysql-test/r/innodb_bug47167.result24
-rw-r--r--mysql-test/r/innodb_file_format.result44
-rw-r--r--mysql-test/r/join_cache.result3
-rw-r--r--mysql-test/r/join_optimizer.result2
-rw-r--r--mysql-test/r/join_outer_jcl6.result15
-rw-r--r--mysql-test/r/log_slow.result7
-rw-r--r--mysql-test/r/log_tables_upgrade.result1
-rw-r--r--mysql-test/r/merge_debug.result4
-rw-r--r--mysql-test/r/myisam.result2
-rw-r--r--mysql-test/r/mysql_upgrade.result8
-rw-r--r--mysql-test/r/mysql_upgrade_ssl.result16
-rw-r--r--mysql-test/r/mysqld--help-notwin.result93
-rw-r--r--mysql-test/r/not_partition.result2
-rw-r--r--mysql-test/r/optimizer_switch.result99
-rw-r--r--mysql-test/r/optimizer_switch_eng_cond_pushdown1.result2
-rw-r--r--mysql-test/r/optimizer_switch_eng_cond_pushdown2.result2
-rw-r--r--mysql-test/r/partition_innodb.result3
-rw-r--r--mysql-test/r/partition_key_cache.result4
-rw-r--r--mysql-test/r/partition_pruning.result2
-rw-r--r--mysql-test/r/plugin.result6
-rw-r--r--mysql-test/r/ps.result4
-rw-r--r--mysql-test/r/query_cache.result9
-rw-r--r--mysql-test/r/query_cache_debug.result12
-rw-r--r--mysql-test/r/select.result2
-rw-r--r--mysql-test/r/select_jcl6.result153
-rw-r--r--mysql-test/r/select_pkeycache.result153
-rw-r--r--mysql-test/r/show_check.result2
-rw-r--r--mysql-test/r/single_delete_update.result54
-rw-r--r--mysql-test/r/sp.result6
-rw-r--r--mysql-test/r/status_user.result1
-rw-r--r--mysql-test/r/subselect.result55
-rw-r--r--mysql-test/r/subselect3.result7
-rw-r--r--mysql-test/r/subselect3_jcl6.result56
-rw-r--r--mysql-test/r/subselect4.result29
-rw-r--r--mysql-test/r/subselect_cache.result232
-rw-r--r--mysql-test/r/subselect_no_mat.result337
-rw-r--r--mysql-test/r/subselect_no_opts.result337
-rw-r--r--mysql-test/r/subselect_no_semijoin.result337
-rw-r--r--mysql-test/r/subselect_sj2.result7
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result9
-rw-r--r--mysql-test/r/table_options.result46
-rw-r--r--mysql-test/r/type_datetime.result6
-rw-r--r--mysql-test/r/type_varchar.result2
-rw-r--r--mysql-test/r/warnings.result2
-rw-r--r--mysql-test/r/xtradb_mrr.result (renamed from mysql-test/r/innodb_mrr.result)0
63 files changed, 1836 insertions, 4283 deletions
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index 55776565f78..0983e9fa8cf 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -12736,7 +12736,8 @@ INSERT INTO t1 (col1, col2) VALUES (1, "value");
ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
REPAIR TABLE t1;
Table Op Msg_type Msg_text
-test.t1 repair status OK
+test.t1 repair Error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+test.t1 repair status Table is already up to date
DROP TABLE t1;
#
# BUG#48757 - missing .ARZ file causes server crash
@@ -12800,12 +12801,3 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
DROP TABLE t1;
-select * from t1;
-ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
-repair table t1;
-Table Op Msg_type Msg_text
-test.t1 repair status OK
-select sum(length(a)),sum(b) from t1;
-sum(length(a)) sum(b)
-8670 187
-drop table t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index c977b0cd30c..0b3ced6cf7f 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1882,7 +1882,7 @@ drop table if exists t1,t2,t3;
# Fix modified for MariaDB: we support this syntax
create table t1 (a int) transactional=0;
Warnings:
-Error 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
+Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
create table t2 (a int) page_checksum=1;
create table t3 (a int) row_format=page;
drop table t1,t2,t3;
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 0e8fe328589..4eab57e4d81 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -2,6 +2,7 @@ set names binary;
#
# Start of 5.5 tests
#
+SET TIME_ZONE = _latin1 '+03:00';
#
# Start of WL#2649 Number-to-string conversions
#
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index b1e9ff38d26..a9ced3e89bf 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -84,6 +84,7 @@ DROP TABLE t1;
#
# Start of 5.5 tests
#
+SET TIME_ZONE = _latin1 '+03:00';
#
# Start of WL#2649 Number-to-string conversions
#
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 6216819d172..b97e6e695af 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -412,6 +412,7 @@ End of 5.0 tests
#
# Start of 5.5 tests
#
+SET TIME_ZONE = _latin1 '+03:00';
#
# Start of WL#2649 Number-to-string conversions
#
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 02c3e348f2a..8d35cf445e8 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -1239,7 +1239,9 @@ WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests
-Start of 5.1 tests
+#
+# Start of 5.1 tests
+#
SET NAMES utf8;
CREATE TABLE t1 (
a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
@@ -1284,10 +1286,14 @@ hex(a)
0064017E
DROP TABLE t1;
#
+# End of 5.1 tests
+#
+#
# Start of 5.5 tests
#
SET NAMES latin1;
SET collation_connection=ucs2_general_ci;
+SET TIME_ZONE = _latin1 '+03:00';
#
# Start of WL#2649 Number-to-string conversions
#
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index 7cee15aecef..0d5280950df 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -1,3 +1,4 @@
+SET TIME_ZONE='+03:00';
DROP TABLE IF EXISTS t1;
#
# Start of 5.5 tests
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 37d5aa98be3..cca4efd1571 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1,3 +1,4 @@
+SET TIME_ZONE = '+03:00';
DROP TABLE IF EXISTS t1;
#
# Start of 5.5 tests
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 295716f48b6..4c3b661ce90 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1,3 +1,4 @@
+SET TIME_ZONE='+03:00';
drop table if exists t1,t2,t3,t4;
drop database if exists mysqltest;
drop table if exists t1,t2;
@@ -2090,6 +2091,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
SET NAMES utf8;
+SET TIME_ZONE = _latin1 '+03:00';
#
# Start of WL#2649 Number-to-string conversions
#
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 307f1714132..ffd6d2fc5b2 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -383,9 +383,9 @@ SELECT b DIV 900 y FROM t1 GROUP BY y;
y
0
Warnings:
-Warning 1366 Incorrect decimal value: '' for column '' at row -1
+Warning 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: 'str1'
-Warning 1366 Incorrect decimal value: '' for column '' at row -1
+Warning 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: 'str2'
SELECT c DIV 900 y FROM t1 GROUP BY y;
y
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 2ae533afa60..e80dcd9793f 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -14,7 +14,7 @@ GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant delete on mysqltest.* to mysqltest_1@localhost;
select * from mysql.user where user="mysqltest_1";
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
@@ -45,14 +45,14 @@ flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
select * from mysql.user where user="mysqltest_1";
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
select * from mysql.user where user="mysqltest_1";
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index 3d3f0e433d5..98647cd369c 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -255,6 +255,24 @@ WHERE
`RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND
`TESTID`='' AND `UCCHECK`='';
drop table t1;
+#
+# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
+#
+CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (2);
+CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
+PRIMARY KEY (f1), KEY (f2), KEY (f3) );
+INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
+SELECT t1.f1 FROM t1
+WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
+f1
+2
+EXPLAIN SELECT t1.f1 FROM t1
+WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
+2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
+DROP TABLE t1,t2;
#
# BUG#56862/640419: Wrong result with sort_union index merge when one
# of the merged index scans is the primary key scan
@@ -291,7 +309,7 @@ SELECT COUNT(*) FROM
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
-2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 11419 Using sort_union(idx,PRIMARY); Using where
+2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6144 Using sort_union(idx,PRIMARY); Using where
SELECT COUNT(*) FROM
(SELECT * FROM t1
WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
@@ -310,21 +328,3 @@ WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
COUNT(*)
6145
DROP TABLE t1;
-#
-# Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
-#
-CREATE TABLE t1 (f1 INT, PRIMARY KEY (f1));
-INSERT INTO t1 VALUES (2);
-CREATE TABLE t2 (f1 INT, f2 INT, f3 char(1),
-PRIMARY KEY (f1), KEY (f2), KEY (f3) );
-INSERT INTO t2 VALUES (1, 1, 'h'), (2, 3, 'h'), (3, 2, ''), (4, 2, '');
-SELECT t1.f1 FROM t1
-WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
-f1
-2
-EXPLAIN SELECT t1.f1 FROM t1
-WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index
-2 DEPENDENT SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index
-DROP TABLE t1,t2;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index e6771f7c563..9ed397bbe1e 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -42,8 +42,8 @@ insert into t5 values (10);
create view v1 (c) as
SELECT table_name FROM information_schema.TABLES
WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND
-table_name not like 'ndb_%' AND table_name not like 'innodb_%';
-and table_name not like 'pbxt%'
+table_name not like 'ndb_%' AND table_name not like 'innodb_%' AND
+table_name not like 'pbxt_%' AND table_name not like 'xtradb_%';
select * from v1;
c
CHARACTER_SETS
@@ -81,8 +81,6 @@ TRIGGERS
USER_PRIVILEGES
USER_STATISTICS
VIEWS
-XTRADB_ADMIN_COMMAND
-XTRADB_ENHANCEMENTS
columns_priv
db
event
@@ -827,8 +825,6 @@ TABLES CREATE_TIME datetime
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime
-INNODB_TRX trx_started datetime
-INNODB_TRX trx_wait_started datetime
event execute_at datetime
event last_executed datetime
event starts datetime
@@ -870,8 +866,6 @@ COLUMNS TABLE_NAME select
COLUMN_PRIVILEGES TABLE_NAME select
FILES TABLE_NAME select
INDEX_STATISTICS TABLE_NAME select
-INNODB_INDEX_STATS table_name select
-INNODB_TABLE_STATS table_name select
KEY_COLUMN_USAGE TABLE_NAME select
PARTITIONS TABLE_NAME select
REFERENTIAL_CONSTRAINTS TABLE_NAME select
@@ -1256,12 +1250,12 @@ DROP PROCEDURE p1;
DROP USER mysql_bug20230@localhost;
SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
MAX(table_name)
-XTRADB_ENHANCEMENTS
+VIEWS
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
table_name
-XTRADB_ENHANCEMENTS
+VIEWS
DROP TABLE IF EXISTS bug23037;
DROP FUNCTION IF EXISTS get_value;
SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
diff --git a/mysql-test/r/innodb-lock.result b/mysql-test/r/innodb-lock.result
deleted file mode 100644
index 4ace4065c34..00000000000
--- a/mysql-test/r/innodb-lock.result
+++ /dev/null
@@ -1,57 +0,0 @@
-set global innodb_table_locks=1;
-select @@innodb_table_locks;
-@@innodb_table_locks
-1
-drop table if exists t1;
-set @@innodb_table_locks=1;
-create table t1 (id integer, x integer) engine=INNODB;
-insert into t1 values(0, 0);
-set autocommit=0;
-SELECT * from t1 where id = 0 FOR UPDATE;
-id x
-0 0
-set autocommit=0;
-lock table t1 write;
-update t1 set x=1 where id = 0;
-select * from t1;
-id x
-0 1
-commit;
-update t1 set x=2 where id = 0;
-commit;
-unlock tables;
-select * from t1;
-id x
-0 2
-commit;
-drop table t1;
-set @@innodb_table_locks=0;
-create table t1 (id integer primary key, x integer) engine=INNODB;
-insert into t1 values(0, 0),(1,1),(2,2);
-commit;
-SELECT * from t1 where id = 0 FOR UPDATE;
-id x
-0 0
-set autocommit=0;
-set @@innodb_table_locks=0;
-lock table t1 write;
-update t1 set x=10 where id = 2;
-SELECT * from t1 where id = 2;
-id x
-2 2
-UPDATE t1 set x=3 where id = 2;
-commit;
-SELECT * from t1;
-id x
-0 0
-1 1
-2 3
-commit;
-unlock tables;
-commit;
-select * from t1;
-id x
-0 0
-1 1
-2 10
-drop table t1;
diff --git a/mysql-test/r/innodb-semi-consistent.result b/mysql-test/r/innodb-semi-consistent.result
deleted file mode 100644
index bfebd3dcacc..00000000000
--- a/mysql-test/r/innodb-semi-consistent.result
+++ /dev/null
@@ -1,47 +0,0 @@
-drop table if exists t1,t2;
-set binlog_format=mixed;
-set session transaction isolation level repeatable read;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-select * from t1 where a=3 lock in share mode;
-a
-3
-set binlog_format=mixed;
-set session transaction isolation level repeatable read;
-set autocommit=0;
-update t1 set a=10 where a=5;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-set session transaction isolation level read committed;
-update t1 set a=10 where a=5;
-select * from t1 where a=2 for update;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-select * from t1 where a=2 limit 1 for update;
-a
-2
-update t1 set a=11 where a=6;
-update t1 set a=12 where a=2;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-update t1 set a=13 where a=1;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-update t1 set a=14 where a=1;
-commit;
-select * from t1;
-a
-14
-2
-3
-4
-10
-11
-7
-drop table t1;
-create table t1 (a int, b int) engine=myisam;
-create table t2 (c int, d int, key (c)) engine=innodb;
-insert into t1 values (1,1);
-insert into t2 values (1,2);
-set session transaction isolation level read committed;
-delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
-drop table t1, t2;
diff --git a/mysql-test/r/innodb-zip.result b/mysql-test/r/innodb-zip.result
deleted file mode 100644
index 21396d81ba8..00000000000
--- a/mysql-test/r/innodb-zip.result
+++ /dev/null
@@ -1,421 +0,0 @@
-set global innodb_file_per_table=off;
-set global innodb_file_format=`0`;
-create table t0(a int primary key) engine=innodb row_format=compressed;
-Warnings:
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t00(a int primary key) engine=innodb
-key_block_size=4 row_format=compressed;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t1(a int primary key) engine=innodb row_format=dynamic;
-Warnings:
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t2(a int primary key) engine=innodb row_format=redundant;
-create table t3(a int primary key) engine=innodb row_format=compact;
-create table t4(a int primary key) engine=innodb key_block_size=9;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
-create table t5(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
-set global innodb_file_per_table=on;
-create table t6(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
-set global innodb_file_format=`1`;
-create table t7(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-create table t8(a int primary key) engine=innodb
-key_block_size=1 row_format=fixed;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t9(a int primary key) engine=innodb
-key_block_size=1 row_format=compact;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-create table t10(a int primary key) engine=innodb
-key_block_size=1 row_format=dynamic;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-create table t11(a int primary key) engine=innodb
-key_block_size=1 row_format=compressed;
-create table t12(a int primary key) engine=innodb
-key_block_size=1;
-create table t13(a int primary key) engine=innodb
-row_format=compressed;
-create table t14(a int primary key) engine=innodb key_block_size=9;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t0 Compact
-test t00 Compact
-test t1 Compact
-test t10 Dynamic
-test t11 Compressed
-test t12 Compressed
-test t13 Compressed
-test t14 Compact
-test t2 Redundant
-test t3 Compact
-test t4 Compact
-test t5 Redundant
-test t6 Redundant
-test t7 Redundant
-test t8 Compact
-test t9 Compact
-drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
-alter table t1 key_block_size=0;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
-alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Dynamic
-alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compact
-alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Redundant
-drop table t1;
-create table t1(a int not null, b text, index(b(10))) engine=innodb
-key_block_size=1;
-create table t2(b text)engine=innodb;
-insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
-insert into t1 select 1, b from t2;
-commit;
-begin;
-update t1 set b=repeat('B',100);
-select a,left(b,40) from t1 natural join t2;
-a left(b,40)
-1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
-rollback;
-select a,left(b,40) from t1 natural join t2;
-a left(b,40)
-1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compressed
-test t2 Compact
-drop table t1,t2;
-SET SESSION innodb_strict_mode = off;
-CREATE TABLE t1(
-c TEXT NOT NULL, d TEXT NOT NULL,
-PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(
-c TEXT NOT NULL, d TEXT NOT NULL,
-PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(
-c TEXT NOT NULL, d TEXT NOT NULL,
-PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
-drop table t1;
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
-DROP TABLE t1;
-create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
-primary key(c1, c2(22), c3(22)))
-engine = innodb row_format = dynamic;
-begin;
-insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
-repeat('C', 20000));
-update t1 set c3 = repeat('D', 20000) where c1 = 1;
-commit;
-select count(*) from t1 where c2 = repeat('A', 20000);
-count(*)
-1
-select count(*) from t1 where c3 = repeat('D', 20000);
-count(*)
-1
-select count(*) from t1 where c4 = repeat('C', 20000);
-count(*)
-1
-update t1 set c3 = repeat('E', 20000) where c1 = 1;
-drop table t1;
-set global innodb_file_format=`0`;
-select @@innodb_file_format;
-@@innodb_file_format
-Antelope
-set global innodb_file_format=`1`;
-select @@innodb_file_format;
-@@innodb_file_format
-Barracuda
-set global innodb_file_format=`2`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`-1`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`Antelope`;
-set global innodb_file_format=`Barracuda`;
-set global innodb_file_format=`Cheetah`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`abc`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`1a`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=``;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_per_table = on;
-set global innodb_file_format = `1`;
-set innodb_strict_mode = off;
-create table t1 (id int primary key) engine = innodb key_block_size = 0;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
-drop table t1;
-set innodb_strict_mode = on;
-create table t1 (id int primary key) engine = innodb key_block_size = 0;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb key_block_size = 9;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb key_block_size = 1;
-create table t4 (id int primary key) engine = innodb key_block_size = 2;
-create table t5 (id int primary key) engine = innodb key_block_size = 4;
-create table t6 (id int primary key) engine = innodb key_block_size = 8;
-create table t7 (id int primary key) engine = innodb key_block_size = 16;
-create table t8 (id int primary key) engine = innodb row_format = compressed;
-create table t9 (id int primary key) engine = innodb row_format = dynamic;
-create table t10(id int primary key) engine = innodb row_format = compact;
-create table t11(id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t10 Compact
-test t11 Redundant
-test t3 Compressed
-test t4 Compressed
-test t5 Compressed
-test t6 Compressed
-test t7 Compressed
-test t8 Compressed
-test t9 Dynamic
-drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
-create table t1 (id int primary key) engine = innodb
-key_block_size = 8 row_format = compressed;
-create table t2 (id int primary key) engine = innodb
-key_block_size = 8 row_format = redundant;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb
-key_block_size = 8 row_format = compact;
-ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t3' (errno: 1478)
-create table t4 (id int primary key) engine = innodb
-key_block_size = 8 row_format = dynamic;
-ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t4' (errno: 1478)
-create table t5 (id int primary key) engine = innodb
-key_block_size = 8 row_format = default;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compressed
-drop table t1;
-create table t1 (id int primary key) engine = innodb
-key_block_size = 9 row_format = redundant;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb
-key_block_size = 9 row_format = compact;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t2 (id int primary key) engine = innodb
-key_block_size = 9 row_format = dynamic;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-set global innodb_file_per_table = off;
-create table t1 (id int primary key) engine = innodb key_block_size = 1;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb key_block_size = 2;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb key_block_size = 4;
-ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t3' (errno: 1478)
-create table t4 (id int primary key) engine = innodb key_block_size = 8;
-ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t4' (errno: 1478)
-create table t5 (id int primary key) engine = innodb key_block_size = 16;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
-create table t6 (id int primary key) engine = innodb row_format = compressed;
-ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t6' (errno: 1478)
-create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t7' (errno: 1478)
-create table t8 (id int primary key) engine = innodb row_format = compact;
-create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t8 Compact
-test t9 Redundant
-drop table t8, t9;
-set global innodb_file_per_table = on;
-set global innodb_file_format = `0`;
-create table t1 (id int primary key) engine = innodb key_block_size = 1;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb key_block_size = 2;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb key_block_size = 4;
-ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t3' (errno: 1478)
-create table t4 (id int primary key) engine = innodb key_block_size = 8;
-ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t4' (errno: 1478)
-create table t5 (id int primary key) engine = innodb key_block_size = 16;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
-create table t6 (id int primary key) engine = innodb row_format = compressed;
-ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t6' (errno: 1478)
-create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show warnings;
-Level Code Message
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t7' (errno: 1478)
-create table t8 (id int primary key) engine = innodb row_format = compact;
-create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t8 Compact
-test t9 Redundant
-drop table t8, t9;
-set global innodb_file_per_table=0;
-set global innodb_file_format=Antelope;
-set global innodb_file_per_table=on;
-set global innodb_file_format=`Barracuda`;
-set global innodb_file_format_check=`Antelope`;
-create table normal_table (
-c1 int
-) engine = innodb;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Antelope
-create table zip_table (
-c1 int
-) engine = innodb key_block_size = 8;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format_check=`Antelope`;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Antelope
-show table status;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-drop table normal_table, zip_table;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
deleted file mode 100644
index ea0972a6a43..00000000000
--- a/mysql-test/r/innodb.result
+++ /dev/null
@@ -1,3305 +0,0 @@
-drop table if exists t1,t2,t3,t4;
-drop database if exists mysqltest;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
-insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
-select id, code, name from t1 order by id;
-id code name
-1 1 Tim
-2 1 Monty
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
-select id, code, name from t1 order by id;
-id code name
-2 1 Monty
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-8 1 Sinisa
-update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
-select id, code, name from t1 order by id;
-id code name
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-8 1 Sinisa
-12 1 Ralph
-drop table t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL auto_increment,
-parent_id int(11) DEFAULT '0' NOT NULL,
-level tinyint(4) DEFAULT '0' NOT NULL,
-PRIMARY KEY (id),
-KEY parent_id (parent_id),
-KEY level (level)
-) engine=innodb;
-INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
-update t1 set parent_id=parent_id+100;
-select * from t1 where parent_id=102;
-id parent_id level
-8 102 2
-9 102 2
-15 102 2
-update t1 set id=id+1000;
-update t1 set id=1024 where id=1009;
-Got one of the listed errors
-select * from t1;
-id parent_id level
-1001 100 0
-1002 101 1
-1003 101 1
-1004 101 1
-1005 101 1
-1006 101 1
-1007 101 1
-1008 102 2
-1009 102 2
-1015 102 2
-1016 103 2
-1017 103 2
-1018 103 2
-1019 103 2
-1020 103 2
-1021 104 2
-1022 104 2
-1024 104 2
-1025 105 2
-1026 105 2
-1027 105 2
-1028 105 2
-1029 105 2
-1030 105 2
-1031 106 2
-1032 106 2
-1033 106 2
-1034 106 2
-1035 106 2
-1036 107 2
-1037 107 2
-1038 107 2
-1040 107 2
-1157 100 0
-1179 105 2
-1183 104 2
-1193 105 2
-1202 107 2
-1203 107 2
-update ignore t1 set id=id+1;
-select * from t1;
-id parent_id level
-1001 100 0
-1002 101 1
-1003 101 1
-1004 101 1
-1005 101 1
-1006 101 1
-1007 101 1
-1008 102 2
-1010 102 2
-1015 102 2
-1016 103 2
-1017 103 2
-1018 103 2
-1019 103 2
-1020 103 2
-1021 104 2
-1023 104 2
-1024 104 2
-1025 105 2
-1026 105 2
-1027 105 2
-1028 105 2
-1029 105 2
-1030 105 2
-1031 106 2
-1032 106 2
-1033 106 2
-1034 106 2
-1035 106 2
-1036 107 2
-1037 107 2
-1039 107 2
-1041 107 2
-1158 100 0
-1180 105 2
-1184 104 2
-1194 105 2
-1202 107 2
-1204 107 2
-update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102;
-id parent_id level
-1008 102 2
-1010 102 2
-1015 102 2
-explain select level from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const # Using index
-explain select level,id from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const # Using index
-explain select level,id,parent_id from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const #
-select level,id from t1 where level=1;
-level id
-1 1002
-1 1003
-1 1004
-1 1005
-1 1006
-1 1007
-select level,id,parent_id from t1 where level=1;
-level id parent_id
-1 1002 101
-1 1003 101
-1 1004 101
-1 1005 101
-1 1006 101
-1 1007 101
-optimize table t1;
-Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize status OK
-show keys from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 id A # NULL NULL BTREE
-t1 1 parent_id 1 parent_id A # NULL NULL BTREE
-t1 1 level 1 level A # NULL NULL BTREE
-drop table t1;
-CREATE TABLE t1 (
-gesuchnr int(11) DEFAULT '0' NOT NULL,
-benutzer_id int(11) DEFAULT '0' NOT NULL,
-PRIMARY KEY (gesuchnr,benutzer_id)
-) engine=innodb;
-replace into t1 (gesuchnr,benutzer_id) values (2,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-select * from t1;
-gesuchnr benutzer_id
-1 1
-2 1
-drop table t1;
-create table t1 (a int) engine=innodb;
-insert into t1 values (1), (2);
-optimize table t1;
-Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize status OK
-delete from t1 where a = 1;
-select * from t1;
-a
-2
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
-create table t1 (a int,b varchar(20)) engine=innodb;
-insert into t1 values (1,""), (2,"testing");
-delete from t1 where a = 1;
-select * from t1;
-a b
-2 testing
-create index skr on t1 (a);
-insert into t1 values (3,""), (4,"testing");
-analyze table t1;
-Table Op Msg_type Msg_text
-test.t1 analyze status OK
-show keys from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 skr 1 a A # NULL NULL YES BTREE
-drop table t1;
-create table t1 (a int,b varchar(20),key(a)) engine=innodb;
-insert into t1 values (1,""), (2,"testing");
-select * from t1 where a = 1;
-a b
-1
-drop table t1;
-create table t1 (n int not null primary key) engine=innodb;
-set autocommit=0;
-insert into t1 values (4);
-rollback;
-select n, "after rollback" from t1;
-n after rollback
-insert into t1 values (4);
-commit;
-select n, "after commit" from t1;
-n after commit
-4 after commit
-commit;
-insert into t1 values (5);
-insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-commit;
-select n, "after commit" from t1;
-n after commit
-4 after commit
-5 after commit
-set autocommit=1;
-insert into t1 values (6);
-insert into t1 values (4);
-ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-select n from t1;
-n
-4
-5
-6
-set autocommit=0;
-begin;
-savepoint `my_savepoint`;
-insert into t1 values (7);
-savepoint `savept2`;
-insert into t1 values (3);
-select n from t1;
-n
-3
-4
-5
-6
-7
-savepoint savept3;
-rollback to savepoint savept2;
-rollback to savepoint savept3;
-ERROR 42000: SAVEPOINT savept3 does not exist
-rollback to savepoint savept2;
-release savepoint `my_savepoint`;
-select n from t1;
-n
-4
-5
-6
-7
-rollback to savepoint `my_savepoint`;
-ERROR 42000: SAVEPOINT my_savepoint does not exist
-rollback to savepoint savept2;
-ERROR 42000: SAVEPOINT savept2 does not exist
-insert into t1 values (8);
-savepoint sv;
-commit;
-savepoint sv;
-set autocommit=1;
-rollback;
-drop table t1;
-create table t1 (n int not null primary key) engine=innodb;
-start transaction;
-insert into t1 values (4);
-flush tables with read lock;
-commit;
-unlock tables;
-commit;
-select * from t1;
-n
-4
-drop table t1;
-create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
-begin;
-insert into t1 values(1,'hamdouni');
-select id as afterbegin_id,nom as afterbegin_nom from t1;
-afterbegin_id afterbegin_nom
-1 hamdouni
-rollback;
-select id as afterrollback_id,nom as afterrollback_nom from t1;
-afterrollback_id afterrollback_nom
-set autocommit=0;
-insert into t1 values(2,'mysql');
-select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
-afterautocommit0_id afterautocommit0_nom
-2 mysql
-rollback;
-select id as afterrollback_id,nom as afterrollback_nom from t1;
-afterrollback_id afterrollback_nom
-set autocommit=1;
-drop table t1;
-CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
-insert into t1 values ('pippo', 12);
-insert into t1 values ('pippo', 12);
-ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
-delete from t1;
-delete from t1 where id = 'pippo';
-select * from t1;
-id val
-insert into t1 values ('pippo', 12);
-set autocommit=0;
-delete from t1;
-rollback;
-select * from t1;
-id val
-pippo 12
-delete from t1;
-commit;
-select * from t1;
-id val
-drop table t1;
-create table t1 (a integer) engine=innodb;
-start transaction;
-rename table t1 to t2;
-create table t1 (b integer) engine=innodb;
-insert into t1 values (1);
-rollback;
-drop table t1;
-rename table t2 to t1;
-drop table t1;
-set autocommit=1;
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
-INSERT INTO t1 VALUES (1, 'Jochen');
-select * from t1;
-ID NAME
-1 Jochen
-drop table t1;
-CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
-set autocommit=0;
-INSERT INTO t1 SET _userid='marc@anyware.co.uk';
-COMMIT;
-SELECT * FROM t1;
-_userid
-marc@anyware.co.uk
-SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
-_userid
-marc@anyware.co.uk
-drop table t1;
-set autocommit=1;
-CREATE TABLE t1 (
-user_id int(10) DEFAULT '0' NOT NULL,
-name varchar(100),
-phone varchar(100),
-ref_email varchar(100) DEFAULT '' NOT NULL,
-detail varchar(200),
-PRIMARY KEY (user_id,ref_email)
-)engine=innodb;
-INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
-select * from t1 where user_id=10292;
-user_id name phone ref_email detail
-10292 sanjeev 29153373 sansh777@hotmail.com xxx
-10292 shirish 2333604 shirish@yahoo.com ddsds
-10292 sonali 323232 sonali@bolly.com filmstar
-INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
-select * from t1 where user_id=10292;
-user_id name phone ref_email detail
-10292 sanjeev 29153373 sansh777@hotmail.com xxx
-10292 shirish 2333604 shirish@yahoo.com ddsds
-10292 sonali 323232 sonali@bolly.com filmstar
-select * from t1 where user_id>=10292;
-user_id name phone ref_email detail
-10292 sanjeev 29153373 sansh777@hotmail.com xxx
-10292 shirish 2333604 shirish@yahoo.com ddsds
-10292 sonali 323232 sonali@bolly.com filmstar
-10293 shirish 2333604 shirish@yahoo.com ddsds
-select * from t1 where user_id>10292;
-user_id name phone ref_email detail
-10293 shirish 2333604 shirish@yahoo.com ddsds
-select * from t1 where user_id<10292;
-user_id name phone ref_email detail
-10291 sanjeev 29153373 sansh777@hotmail.com xxx
-drop table t1;
-CREATE TABLE t1 (a int not null, b int not null,c int not null,
-key(a),primary key(a,b), unique(c),key(a),unique(b));
-show index from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a A # NULL NULL BTREE
-t1 0 PRIMARY 2 b A # NULL NULL BTREE
-t1 0 c 1 c A # NULL NULL BTREE
-t1 0 b 1 b A # NULL NULL BTREE
-t1 1 a 1 a A # NULL NULL BTREE
-t1 1 a_2 1 a A # NULL NULL BTREE
-drop table t1;
-create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
-alter table t1 engine=innodb;
-insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
-select * from t1;
-col1 col2
-1 1
-2 3
-3 4
-4 4
-5 2
-update t1 set col2='7' where col1='4';
-select * from t1;
-col1 col2
-1 1
-2 3
-3 4
-4 7
-5 2
-alter table t1 add co3 int not null;
-select * from t1;
-col1 col2 co3
-1 1 0
-2 3 0
-3 4 0
-4 7 0
-5 2 0
-update t1 set col2='9' where col1='2';
-select * from t1;
-col1 col2 co3
-1 1 0
-2 9 0
-3 4 0
-4 7 0
-5 2 0
-drop table t1;
-create table t1 (a int not null , b int, primary key (a)) engine = innodb;
-create table t2 (a int not null , b int, primary key (a)) engine = myisam;
-insert into t1 VALUES (1,3) , (2,3), (3,3);
-select * from t1;
-a b
-1 3
-2 3
-3 3
-insert into t2 select * from t1;
-select * from t2;
-a b
-1 3
-2 3
-3 3
-delete from t1 where b = 3;
-select * from t1;
-a b
-insert into t1 select * from t2;
-select * from t1;
-a b
-1 3
-2 3
-3 3
-select * from t2;
-a b
-1 3
-2 3
-3 3
-drop table t1,t2;
-CREATE TABLE t1 (
-user_name varchar(12),
-password text,
-subscribed char(1),
-user_id int(11) DEFAULT '0' NOT NULL,
-quota bigint(20),
-weight double,
-access_date date,
-access_time time,
-approved datetime,
-dummy_primary_key int(11) NOT NULL auto_increment,
-PRIMARY KEY (dummy_primary_key)
-) ENGINE=innodb;
-INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
-INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
-INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
-INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
-INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
-select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
-user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
-user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
-user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
-user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
-user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
-user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
-drop table t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL auto_increment,
-parent_id int(11) DEFAULT '0' NOT NULL,
-level tinyint(4) DEFAULT '0' NOT NULL,
-KEY (id),
-KEY parent_id (parent_id),
-KEY level (level)
-) engine=innodb;
-INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
-INSERT INTO t1 values (179,5,2);
-update t1 set parent_id=parent_id+100;
-select * from t1 where parent_id=102;
-id parent_id level
-8 102 2
-9 102 2
-15 102 2
-update t1 set id=id+1000;
-update t1 set id=1024 where id=1009;
-select * from t1;
-id parent_id level
-1001 100 0
-1003 101 1
-1004 101 1
-1008 102 2
-1024 102 2
-1017 103 2
-1022 104 2
-1024 104 2
-1028 105 2
-1029 105 2
-1030 105 2
-1031 106 2
-1032 106 2
-1033 106 2
-1203 107 2
-1202 107 2
-1020 103 2
-1157 100 0
-1193 105 2
-1040 107 2
-1002 101 1
-1015 102 2
-1006 101 1
-1034 106 2
-1035 106 2
-1016 103 2
-1007 101 1
-1036 107 2
-1018 103 2
-1026 105 2
-1027 105 2
-1183 104 2
-1038 107 2
-1025 105 2
-1037 107 2
-1021 104 2
-1019 103 2
-1005 101 1
-1179 105 2
-update ignore t1 set id=id+1;
-select * from t1;
-id parent_id level
-1002 100 0
-1004 101 1
-1005 101 1
-1009 102 2
-1025 102 2
-1018 103 2
-1023 104 2
-1025 104 2
-1029 105 2
-1030 105 2
-1031 105 2
-1032 106 2
-1033 106 2
-1034 106 2
-1204 107 2
-1203 107 2
-1021 103 2
-1158 100 0
-1194 105 2
-1041 107 2
-1003 101 1
-1016 102 2
-1007 101 1
-1035 106 2
-1036 106 2
-1017 103 2
-1008 101 1
-1037 107 2
-1019 103 2
-1027 105 2
-1028 105 2
-1184 104 2
-1039 107 2
-1026 105 2
-1038 107 2
-1022 104 2
-1020 103 2
-1006 101 1
-1180 105 2
-update ignore t1 set id=1023 where id=1010;
-select * from t1 where parent_id=102;
-id parent_id level
-1009 102 2
-1025 102 2
-1016 102 2
-explain select level from t1 where level=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref level level 1 const # Using index
-select level,id from t1 where level=1;
-level id
-1 1004
-1 1005
-1 1003
-1 1007
-1 1008
-1 1006
-select level,id,parent_id from t1 where level=1;
-level id parent_id
-1 1004 101
-1 1005 101
-1 1003 101
-1 1007 101
-1 1008 101
-1 1006 101
-select level,id from t1 where level=1 order by id;
-level id
-1 1003
-1 1004
-1 1005
-1 1006
-1 1007
-1 1008
-delete from t1 where level=1;
-select * from t1;
-id parent_id level
-1002 100 0
-1009 102 2
-1025 102 2
-1018 103 2
-1023 104 2
-1025 104 2
-1029 105 2
-1030 105 2
-1031 105 2
-1032 106 2
-1033 106 2
-1034 106 2
-1204 107 2
-1203 107 2
-1021 103 2
-1158 100 0
-1194 105 2
-1041 107 2
-1016 102 2
-1035 106 2
-1036 106 2
-1017 103 2
-1037 107 2
-1019 103 2
-1027 105 2
-1028 105 2
-1184 104 2
-1039 107 2
-1026 105 2
-1038 107 2
-1022 104 2
-1020 103 2
-1180 105 2
-drop table t1;
-CREATE TABLE t1 (
-sca_code char(6) NOT NULL,
-cat_code char(6) NOT NULL,
-sca_desc varchar(50),
-lan_code char(2) NOT NULL,
-sca_pic varchar(100),
-sca_sdesc varchar(50),
-sca_sch_desc varchar(16),
-PRIMARY KEY (sca_code, cat_code, lan_code),
-INDEX sca_pic (sca_pic)
-) engine = innodb ;
-INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
-select count(*) from t1 where sca_code = 'PD';
-count(*)
-1
-select count(*) from t1 where sca_code <= 'PD';
-count(*)
-1
-select count(*) from t1 where sca_pic is null;
-count(*)
-2
-alter table t1 drop index sca_pic;
-alter table t1 add index sca_pic (cat_code, sca_pic);
-select count(*) from t1 where sca_code='PD' and sca_pic is null;
-count(*)
-1
-select count(*) from t1 where cat_code='E';
-count(*)
-0
-alter table t1 drop index sca_pic;
-alter table t1 add index (sca_pic, cat_code);
-select count(*) from t1 where sca_code='PD' and sca_pic is null;
-count(*)
-1
-select count(*) from t1 where sca_pic >= 'n';
-count(*)
-1
-select sca_pic from t1 where sca_pic is null;
-sca_pic
-NULL
-NULL
-update t1 set sca_pic="test" where sca_pic is null;
-delete from t1 where sca_code='pd';
-drop table t1;
-set @a:=now();
-CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
-insert into t1 (a) values(1),(2),(3);
-select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
-a
-1
-2
-3
-select a from t1 natural join t1 as t2 where b >= @a order by a;
-a
-1
-2
-3
-update t1 set a=5 where a=1;
-select a from t1;
-a
-2
-3
-5
-drop table t1;
-create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
-insert into t1 values("hello",1),("world",2);
-select * from t1 order by b desc;
-a b
-world 2
-hello 1
-optimize table t1;
-Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize status OK
-show keys from t1;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 0 PRIMARY 1 a A # NULL NULL BTREE
-drop table t1;
-create table t1 (i int, j int ) ENGINE=innodb;
-insert into t1 values (1,2);
-select * from t1 where i=1 and j=2;
-i j
-1 2
-create index ax1 on t1 (i,j);
-select * from t1 where i=1 and j=2;
-i j
-1 2
-drop table t1;
-CREATE TABLE t1 (
-a int3 unsigned NOT NULL,
-b int1 unsigned NOT NULL,
-UNIQUE (a, b)
-) ENGINE = innodb;
-INSERT INTO t1 VALUES (1, 1);
-SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
-MIN(B) MAX(b)
-1 1
-drop table t1;
-CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t1;
-a
-1
-DROP TABLE t1;
-create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
-insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
-explain select * from t1 where a > 0 and a < 50;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
-drop table t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
-LOCK TABLES t1 WRITE;
-insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
-select id from t1;
-id
-0
-1
-2
-select id from t1;
-id
-0
-1
-2
-UNLOCK TABLES;
-DROP TABLE t1;
-create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
-insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
-LOCK TABLES t1 WRITE;
-begin;
-insert into t1 values (99,1,2,'D'),(1,1,2,'D');
-ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
-select id from t1;
-id
-0
-1
-2
-insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
-commit;
-select id,id3 from t1;
-id id3
-0 0
-1 1
-2 2
-100 2
-UNLOCK TABLES;
-DROP TABLE t1;
-create table t1 (a char(20), unique (a(5))) engine=innodb;
-drop table t1;
-create table t1 (a char(20), index (a(5))) engine=innodb;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` char(20) DEFAULT NULL,
- KEY `a` (`a`(5))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
-insert into t1 values (NULL),(NULL),(NULL);
-delete from t1 where a=3;
-insert into t1 values (NULL);
-select * from t1;
-a
-1
-2
-4
-alter table t1 add b int;
-select * from t1;
-a b
-1 NULL
-2 NULL
-4 NULL
-drop table t1;
-create table t1
-(
-id int auto_increment primary key,
-name varchar(32) not null,
-value text not null,
-uid int not null,
-unique key(name,uid)
-) engine=innodb;
-insert into t1 values (1,'one','one value',101),
-(2,'two','two value',102),(3,'three','three value',103);
-set insert_id=5;
-replace into t1 (value,name,uid) values ('other value','two',102);
-delete from t1 where uid=102;
-set insert_id=5;
-replace into t1 (value,name,uid) values ('other value','two',102);
-set insert_id=6;
-replace into t1 (value,name,uid) values ('other value','two',102);
-select * from t1;
-id name value uid
-1 one one value 101
-3 three three value 103
-6 two other value 102
-drop table t1;
-create database mysqltest;
-create table mysqltest.t1 (a int not null) engine= innodb;
-insert into mysqltest.t1 values(1);
-create table mysqltest.t2 (a int not null) engine= myisam;
-insert into mysqltest.t2 values(1);
-create table mysqltest.t3 (a int not null) engine= heap;
-insert into mysqltest.t3 values(1);
-commit;
-drop database mysqltest;
-show tables from mysqltest;
-ERROR 42000: Unknown database 'mysqltest'
-set autocommit=0;
-create table t1 (a int not null) engine= innodb;
-insert into t1 values(1),(2);
-truncate table t1;
-commit;
-truncate table t1;
-truncate table t1;
-select * from t1;
-a
-insert into t1 values(1),(2);
-delete from t1;
-select * from t1;
-a
-commit;
-drop table t1;
-set autocommit=1;
-create table t1 (a int not null) engine= innodb;
-insert into t1 values(1),(2);
-truncate table t1;
-insert into t1 values(1),(2);
-select * from t1;
-a
-1
-2
-truncate table t1;
-insert into t1 values(1),(2);
-delete from t1;
-select * from t1;
-a
-drop table t1;
-create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
-insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL #
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
-explain select * from t1 order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
-explain select a from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
-explain select b from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 4 NULL # Using index
-explain select a,b from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 4 NULL # Using index
-explain select a,b from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 4 NULL # Using index
-explain select a,b,c from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL #
-drop table t1;
-create table t1 (t int not null default 1, key (t)) engine=innodb;
-desc t1;
-Field Type Null Key Default Extra
-t int(11) NO MUL 1
-drop table t1;
-CREATE TABLE t1 (
-number bigint(20) NOT NULL default '0',
-cname char(15) NOT NULL default '',
-carrier_id smallint(6) NOT NULL default '0',
-privacy tinyint(4) NOT NULL default '0',
-last_mod_date timestamp NOT NULL,
-last_mod_id smallint(6) NOT NULL default '0',
-last_app_date timestamp NOT NULL,
-last_app_id smallint(6) default '-1',
-version smallint(6) NOT NULL default '0',
-assigned_scps int(11) default '0',
-status tinyint(4) default '0'
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
-INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
-INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
-INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
-INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
-INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
-CREATE TABLE t2 (
-number bigint(20) NOT NULL default '0',
-cname char(15) NOT NULL default '',
-carrier_id smallint(6) NOT NULL default '0',
-privacy tinyint(4) NOT NULL default '0',
-last_mod_date timestamp NOT NULL,
-last_mod_id smallint(6) NOT NULL default '0',
-last_app_date timestamp NOT NULL,
-last_app_id smallint(6) default '-1',
-version smallint(6) NOT NULL default '0',
-assigned_scps int(11) default '0',
-status tinyint(4) default '0'
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
-INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
-INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
-INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
-select * from t1;
-number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
-9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
-650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
-302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
-6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
-333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
-select * from t2;
-number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
-9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
-650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
-333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
-delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
-select * from t1;
-number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
-333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
-select * from t2;
-number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
-select * from t2;
-number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
-333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
-drop table t1,t2;
-create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
-BEGIN;
-SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-SELECT @@tx_isolation,@@global.tx_isolation;
-@@tx_isolation @@global.tx_isolation
-SERIALIZABLE REPEATABLE-READ
-insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
-select id, code, name from t1 order by id;
-id code name
-1 1 Tim
-2 1 Monty
-3 2 David
-COMMIT;
-BEGIN;
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
-select id, code, name from t1 order by id;
-id code name
-1 1 Tim
-2 1 Monty
-3 2 David
-4 2 Erik
-5 3 Sasha
-COMMIT;
-SET binlog_format='MIXED';
-BEGIN;
-SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
-insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
-select id, code, name from t1 order by id;
-id code name
-1 1 Tim
-2 1 Monty
-3 2 David
-4 2 Erik
-5 3 Sasha
-6 3 Jeremy
-7 4 Matt
-COMMIT;
-DROP TABLE t1;
-create table t1 (n int(10), d int(10)) engine=innodb;
-create table t2 (n int(10), d int(10)) engine=innodb;
-insert into t1 values(1,1),(1,2);
-insert into t2 values(1,10),(2,20);
-UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
-select * from t1;
-n d
-1 10
-1 10
-select * from t2;
-n d
-1 30
-2 20
-drop table t1,t2;
-drop table if exists t1, t2;
-CREATE TABLE t1 (a int, PRIMARY KEY (a));
-CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
-create trigger trg_del_t2 after delete on t2 for each row
-insert into t1 values (1);
-insert into t1 values (1);
-insert into t2 values (1),(2);
-delete t2 from t2;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
-count(*)
-2
-drop table t1, t2;
-drop table if exists t1, t2;
-CREATE TABLE t1 (a int, PRIMARY KEY (a));
-CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
-create trigger trg_del_t2 after delete on t2 for each row
-insert into t1 values (1);
-insert into t1 values (1);
-insert into t2 values (1),(2);
-delete t2 from t2;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
-count(*)
-2
-drop table t1, t2;
-create table t1 (a int, b int) engine=innodb;
-insert into t1 values(20,null);
-select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
-t2.b=t3.a;
-b ifnull(t2.b,"this is null")
-NULL this is null
-select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
-t2.b=t3.a order by 1;
-b ifnull(t2.b,"this is null")
-NULL this is null
-insert into t1 values(10,null);
-select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
-t2.b=t3.a order by 1;
-b ifnull(t2.b,"this is null")
-NULL this is null
-NULL this is null
-drop table t1;
-create table t1 (a varchar(10) not null) engine=myisam;
-create table t2 (b varchar(10) not null unique) engine=innodb;
-select t1.a from t1,t2 where t1.a=t2.b;
-a
-drop table t1,t2;
-create table t1 (a int not null, b int, primary key (a)) engine = innodb;
-create table t2 (a int not null, b int, primary key (a)) engine = innodb;
-insert into t1 values (10, 20);
-insert into t2 values (10, 20);
-update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
-drop table t1,t2;
-CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
-insert into t1 set id=1;
-insert into t2 set id=1, t1_id=1;
-delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
-select * from t1;
-id
-select * from t2;
-id t1_id
-drop table t2,t1;
-CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
-CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
-INSERT INTO t1 VALUES(1);
-INSERT INTO t2 VALUES(1, 1);
-SELECT * from t1;
-id
-1
-UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
-SELECT * from t1;
-id
-2
-UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
-SELECT * from t1;
-id
-3
-DROP TABLE t1,t2;
-set autocommit=0;
-CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
-CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
-CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
-INSERT INTO t3 VALUES("my-test-1", "my-test-2");
-COMMIT;
-INSERT INTO t1 VALUES("this-key", "will disappear");
-INSERT INTO t2 VALUES("this-key", "will also disappear");
-DELETE FROM t3 WHERE id1="my-test-1";
-SELECT * FROM t1;
-id value
-this-key will disappear
-SELECT * FROM t2;
-id value
-this-key will also disappear
-SELECT * FROM t3;
-id1 id2
-ROLLBACK;
-SELECT * FROM t1;
-id value
-SELECT * FROM t2;
-id value
-SELECT * FROM t3;
-id1 id2
-my-test-1 my-test-2
-SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
-id1 id2
-my-test-1 my-test-2
-COMMIT;
-set autocommit=1;
-DROP TABLE t1,t2,t3;
-CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
-SELECT * from t1;
-a b
-1 1
-102 2
-103 3
-4 4
-5 5
-6 6
-7 7
-8 8
-9 9
-drop table t1;
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-a b
-101 1
-102 2
-103 3
-104 4
-105 5
-106 6
-107 7
-108 8
-109 9
-110 10
-111 11
-112 12
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-a b
-201 1
-102 2
-103 3
-104 4
-105 5
-106 6
-107 7
-108 8
-109 9
-110 10
-111 11
-112 12
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-a b
-201 1
-103 3
-104 4
-105 5
-106 6
-107 7
-108 8
-109 9
-110 10
-111 11
-102 12
-112 12
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-a b
-201 1
-103 5
-104 6
-106 6
-105 7
-107 7
-108 8
-109 9
-110 10
-111 11
-102 12
-112 12
-select * from t2;
-a b
-1 1
-2 2
-6 6
-7 7
-8 8
-9 9
-3 13
-4 14
-5 15
-drop table t1,t2;
-CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
-CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
-SET AUTOCOMMIT=0;
-INSERT INTO t1 ( B_ID ) VALUES ( 1 );
-INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-SELECT * FROM t1;
-B_ID
-drop table t1,t2;
-create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
-insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
-select distinct parent,child from t1 order by parent;
-parent child
-0 4
-1 2
-1 3
-2 1
-drop table t1;
-create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
-create table t2 (a int not null auto_increment primary key, b int);
-insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
-insert into t2 (a) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-insert into t2 (a) select b from t1;
-insert into t1 (a) select b from t2;
-select count(*) from t1;
-count(*)
-623
-explain select * from t1 where c between 1 and 2500;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range c c 5 NULL # Using index condition; Using MRR
-update t1 set c=a;
-explain select * from t1 where c between 1 and 2500;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL c NULL NULL NULL # Using where
-drop table t1,t2;
-create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
-insert into t1 (id) values (null),(null),(null),(null),(null);
-update t1 set fk=69 where fk is null order by id limit 1;
-SELECT * from t1;
-id fk
-2 NULL
-3 NULL
-4 NULL
-5 NULL
-1 69
-drop table t1;
-create table t1 (a int not null, b int not null, key (a));
-insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
-SET @tmp=0;
-update t1 set b=(@tmp:=@tmp+1) order by a;
-update t1 set b=99 where a=1 order by b asc limit 1;
-update t1 set b=100 where a=1 order by b desc limit 2;
-update t1 set a=a+10+b where a=1 order by b;
-select * from t1 order by a,b;
-a b
-2 4
-2 5
-2 6
-3 7
-3 8
-3 9
-3 10
-3 11
-3 12
-13 2
-111 100
-111 100
-drop table t1;
-create table t1 ( c char(8) not null ) engine=innodb;
-insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
-insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
-alter table t1 add b char(8) not null;
-alter table t1 add a char(8) not null;
-alter table t1 add primary key (a,b,c);
-update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
-insert into t2 select * from t1;
-delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
-drop table t1,t2;
-SET AUTOCOMMIT=1;
-create table t1 (a integer auto_increment primary key) engine=innodb;
-insert into t1 (a) values (NULL),(NULL);
-truncate table t1;
-insert into t1 (a) values (NULL),(NULL);
-SELECT * from t1;
-a
-1
-2
-drop table t1;
-CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
-drop table t2,t1;
-create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
-insert into `t1`values ( 1 ) ;
-create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
-insert into `t2`values ( 1 ) ;
-create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
-insert into `t3`values ( 1 ) ;
-delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
-update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
-update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 42S22: Unknown column 't1.id' in 'where clause'
-drop table t3,t2,t1;
-create table t1(
-id int primary key,
-pid int,
-index(pid),
-foreign key(pid) references t1(id) on delete cascade) engine=innodb;
-insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
-(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
-delete from t1 where id=0;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
-delete from t1 where id=15;
-delete from t1 where id=0;
-drop table t1;
-CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
-CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
-(stamp))ENGINE=InnoDB;
-insert into t1 values (1),(2),(3);
-insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
-Warnings:
-Warning 1265 Data truncated for column 'stamp' at row 3
-SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
-'20020204120000' GROUP BY col1;
-col1
-1
-2
-3
-4
-drop table t1,t2;
-CREATE TABLE t1 (
-`id` int(10) unsigned NOT NULL auto_increment,
-`id_object` int(10) unsigned default '0',
-`id_version` int(10) unsigned NOT NULL default '1',
-`label` varchar(100) NOT NULL default '',
-`description` text,
-PRIMARY KEY (`id`),
-KEY `id_object` (`id_object`),
-KEY `id_version` (`id_version`)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
-CREATE TABLE t2 (
-`id` int(10) unsigned NOT NULL auto_increment,
-`id_version` int(10) unsigned NOT NULL default '1',
-PRIMARY KEY (`id`),
-KEY `id_version` (`id_version`)
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
-SELECT t2.id, t1.`label` FROM t2 INNER JOIN
-(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
-ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
-id label
-3382 Test
-102 Le Pekin (Test)
-1794 Test de resto
-1822 Test 3
-3524 Societe Test
-3525 Fournisseur Test
-drop table t1,t2;
-create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
-create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
-create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
-insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
-insert t2 select * from t1;
-insert t3 select * from t1;
-checksum table t1, t2, t3, t4 quick;
-Table Checksum
-test.t1 3442722830
-test.t2 NULL
-test.t3 NULL
-test.t4 NULL
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
-checksum table t1, t2, t3, t4;
-Table Checksum
-test.t1 3442722830
-test.t2 3442722830
-test.t3 3442722830
-test.t4 NULL
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
-checksum table t1, t2, t3, t4 extended;
-Table Checksum
-test.t1 3442722830
-test.t2 3442722830
-test.t3 3442722830
-test.t4 NULL
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
-drop table t1,t2,t3;
-create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
-insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
-select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
-trim(name2)
-fff
-sss
-ttt
-first
-second
-third
-1
-2
-3
-drop table t1;
-create table t1 (a int) engine=innodb;
-create table t2 like t1;
-drop table t1,t2;
-create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
-create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `id` int(11) NOT NULL,
- `id2` int(11) NOT NULL,
- UNIQUE KEY `id` (`id`,`id2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- KEY `t1_id_fk` (`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-create index id on t2 (id);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- KEY `id` (`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-create index id2 on t2 (id);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- KEY `id` (`id`),
- KEY `id2` (`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop index id2 on t2;
-drop index id on t2;
-ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- KEY `id` (`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- `id2` int(11) NOT NULL,
- KEY `t1_id_fk` (`id`,`id2`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-create unique index id on t2 (id,id2);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- `id2` int(11) NOT NULL,
- UNIQUE KEY `id` (`id`,`id2`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- `id2` int(11) NOT NULL,
- UNIQUE KEY `id` (`id`,`id2`),
- KEY `t1_id_fk` (`id2`,`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- `id2` int(11) NOT NULL,
- UNIQUE KEY `id` (`id`,`id2`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- `id2` int(11) NOT NULL,
- UNIQUE KEY `id` (`id`,`id2`),
- KEY `t1_id_fk` (`id2`,`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `id2` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `id` (`id`,`id2`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `id2` int(11) NOT NULL,
- KEY `t1_id_fk` (`id`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t2 add index id_test (id), add index id_test2 (id,id2);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `id2` int(11) NOT NULL,
- KEY `id_test` (`id`),
- KEY `id_test2` (`id`,`id2`),
- CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
-ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
-create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) NOT NULL AUTO_INCREMENT,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b_2` (`b`),
- KEY `b` (`b`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2;
-create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) NOT NULL AUTO_INCREMENT,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
- CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t2, t1;
-create table t1 (c char(10), index (c,c)) engine=innodb;
-ERROR 42S21: Duplicate column name 'c'
-create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
-ERROR 42S21: Duplicate column name 'c1'
-create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
-ERROR 42S21: Duplicate column name 'c1'
-create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
-ERROR 42S21: Duplicate column name 'c1'
-create table t1 (c1 char(10), c2 char(10)) engine=innodb;
-alter table t1 add key (c1,c1);
-ERROR 42S21: Duplicate column name 'c1'
-alter table t1 add key (c2,c1,c1);
-ERROR 42S21: Duplicate column name 'c1'
-alter table t1 add key (c1,c2,c1);
-ERROR 42S21: Duplicate column name 'c1'
-alter table t1 add key (c1,c1,c2);
-ERROR 42S21: Duplicate column name 'c1'
-drop table t1;
-create table t1(a int(1) , b int(1)) engine=innodb;
-insert into t1 values ('1111', '3333');
-select distinct concat(a, b) from t1;
-concat(a, b)
-11113333
-drop table t1;
-CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
-SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
-ERROR HY000: The used table type doesn't support FULLTEXT indexes
-DROP TABLE t1;
-CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES (1),(2),(3);
-CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
-CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
-SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
-a_id b_list
-1 1,2,3
-2 4,5
-3 NULL
-DROP TABLE t2;
-DROP TABLE t1;
-create temporary table t1 (a int) engine=innodb;
-insert into t1 values (4711);
-truncate t1;
-insert into t1 values (42);
-select * from t1;
-a
-42
-drop table t1;
-create table t1 (a int) engine=innodb;
-insert into t1 values (4711);
-truncate t1;
-insert into t1 values (42);
-select * from t1;
-a
-42
-drop table t1;
-create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
-insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
-select * from t1 order by a,b,c,d;
-a b c d e
-1 1 a 1 1
-2 2 b 2 2
-3 3 ab 3 3
-explain select * from t1 order by a,b,c,d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
-drop table t1;
-create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
-insert into t1 values ('8', '6'), ('4', '7');
-select min(a) from t1;
-min(a)
-4
-select min(b) from t1 where a='8';
-min(b)
-6
-drop table t1;
-create table t1 (x bigint unsigned not null primary key) engine=innodb;
-insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
-select * from t1;
-x
-18446744073709551600
-18446744073709551601
-select count(*) from t1 where x>0;
-count(*)
-2
-select count(*) from t1 where x=0;
-count(*)
-0
-select count(*) from t1 where x<0;
-count(*)
-0
-select count(*) from t1 where x < -16;
-count(*)
-0
-select count(*) from t1 where x = -16;
-count(*)
-0
-explain select count(*) from t1 where x > -16;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index
-select count(*) from t1 where x > -16;
-count(*)
-2
-select * from t1 where x > -16;
-x
-18446744073709551600
-18446744073709551601
-select count(*) from t1 where x = 18446744073709551601;
-count(*)
-1
-drop table t1;
-SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
-variable_value
-8191
-SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
-variable_value
-16384
-SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
-variable_value - @innodb_rows_deleted_orig
-71
-SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
-variable_value - @innodb_rows_inserted_orig
-1084
-SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
-variable_value - @innodb_rows_updated_orig
-885
-SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
-variable_value - @innodb_row_lock_waits_orig
-0
-SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
-variable_value - @innodb_row_lock_current_waits_orig
-0
-SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
-variable_value - @innodb_row_lock_time_orig
-0
-SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
-variable_value - @innodb_row_lock_time_max_orig
-0
-SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
-variable_value - @innodb_row_lock_time_avg_orig
-0
-SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops;
-show variables like "innodb_sync_spin_loops";
-Variable_name Value
-innodb_sync_spin_loops 30
-set global innodb_sync_spin_loops=1000;
-show variables like "innodb_sync_spin_loops";
-Variable_name Value
-innodb_sync_spin_loops 1000
-set global innodb_sync_spin_loops=0;
-show variables like "innodb_sync_spin_loops";
-Variable_name Value
-innodb_sync_spin_loops 0
-set global innodb_sync_spin_loops=20;
-show variables like "innodb_sync_spin_loops";
-Variable_name Value
-innodb_sync_spin_loops 20
-set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
-SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
-show variables like "innodb_thread_concurrency";
-Variable_name Value
-innodb_thread_concurrency 0
-set global innodb_thread_concurrency=1001;
-Warnings:
-Warning 1292 Truncated incorrect thread_concurrency value: '1001'
-show variables like "innodb_thread_concurrency";
-Variable_name Value
-innodb_thread_concurrency 1000
-set global innodb_thread_concurrency=0;
-show variables like "innodb_thread_concurrency";
-Variable_name Value
-innodb_thread_concurrency 0
-set global innodb_thread_concurrency=16;
-show variables like "innodb_thread_concurrency";
-Variable_name Value
-innodb_thread_concurrency 16
-SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
-show variables like "innodb_concurrency_tickets";
-Variable_name Value
-innodb_concurrency_tickets 500
-set global innodb_concurrency_tickets=1000;
-show variables like "innodb_concurrency_tickets";
-Variable_name Value
-innodb_concurrency_tickets 1000
-set global innodb_concurrency_tickets=0;
-Warnings:
-Warning 1292 Truncated incorrect concurrency_tickets value: '0'
-show variables like "innodb_concurrency_tickets";
-Variable_name Value
-innodb_concurrency_tickets 1
-set global innodb_concurrency_tickets=500;
-show variables like "innodb_concurrency_tickets";
-Variable_name Value
-innodb_concurrency_tickets 500
-show variables like "innodb_thread_sleep_delay";
-Variable_name Value
-innodb_thread_sleep_delay 10000
-set global innodb_thread_sleep_delay=100000;
-show variables like "innodb_thread_sleep_delay";
-Variable_name Value
-innodb_thread_sleep_delay 100000
-set global innodb_thread_sleep_delay=0;
-show variables like "innodb_thread_sleep_delay";
-Variable_name Value
-innodb_thread_sleep_delay 0
-set global innodb_thread_sleep_delay=10000;
-show variables like "innodb_thread_sleep_delay";
-Variable_name Value
-innodb_thread_sleep_delay 10000
-set storage_engine=INNODB;
-drop table if exists t1,t2,t3;
---- Testing varchar ---
---- Testing varchar ---
-create table t1 (v varchar(10), c char(10), t text);
-insert into t1 values('+ ', '+ ', '+ ');
-set @a=repeat(' ',20);
-insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
-Warnings:
-Note 1265 Data truncated for column 'v' at row 1
-select concat('*',v,'*',c,'*',t,'*') from t1;
-concat('*',v,'*',c,'*',t,'*')
-*+ *+*+ *
-*+ *+*+ *
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-create table t2 like t1;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `v` varchar(10) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-create table t3 select * from t1;
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `v` varchar(10) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 modify c varchar(10);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) DEFAULT NULL,
- `c` varchar(10) DEFAULT NULL,
- `t` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 modify v char(10);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` char(10) DEFAULT NULL,
- `c` varchar(10) DEFAULT NULL,
- `t` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 modify t varchar(10);
-Warnings:
-Note 1265 Data truncated for column 't' at row 2
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` char(10) DEFAULT NULL,
- `c` varchar(10) DEFAULT NULL,
- `t` varchar(10) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-select concat('*',v,'*',c,'*',t,'*') from t1;
-concat('*',v,'*',c,'*',t,'*')
-*+*+*+ *
-*+*+*+ *
-drop table t1,t2,t3;
-create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text,
- KEY `v` (`v`),
- KEY `c` (`c`),
- KEY `t` (`t`(10))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-select count(*) from t1;
-count(*)
-270
-insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
-select count(*) from t1 where v='a';
-count(*)
-10
-select count(*) from t1 where c='a';
-count(*)
-10
-select count(*) from t1 where t='a';
-count(*)
-10
-select count(*) from t1 where v='a ';
-count(*)
-10
-select count(*) from t1 where c='a ';
-count(*)
-10
-select count(*) from t1 where t='a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-count(*)
-10
-select count(*) from t1 where v like 'a%';
-count(*)
-11
-select count(*) from t1 where c like 'a%';
-count(*)
-11
-select count(*) from t1 where t like 'a%';
-count(*)
-11
-select count(*) from t1 where v like 'a %';
-count(*)
-9
-explain select count(*) from t1 where v='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 13 const # Using where; Using index
-explain select count(*) from t1 where c='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c c 11 const # Using where; Using index
-explain select count(*) from t1 where t='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref t t 13 const # Using where
-explain select count(*) from t1 where v like 'a%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 13 NULL # Using where; Using index
-explain select count(*) from t1 where v between 'a' and 'a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 13 const # Using where; Using index
-explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 13 const # Using where; Using index
-alter table t1 add unique(v);
-ERROR 23000: Duplicate entry '{ ' for key 'v_2'
-alter table t1 add key(v);
-select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
-qq
-*a*a*a*
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-*a *a*a *
-explain select * from t1 where v='a';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v,v_2 # 13 const # Using index condition
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(c) from t1 group by v limit 10;
-v count(c)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(c) from t1 group by v limit 10;
-v count(c)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select c,count(*) from t1 group by c limit 10;
-c count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select c,count(t) from t1 group by c limit 10;
-c count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result c,count(t) from t1 group by c limit 10;
-c count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select t,count(*) from t1 group by t limit 10;
-t count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select t,count(t) from t1 group by t limit 10;
-t count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result t,count(t) from t1 group by t limit 10;
-t count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(300) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text,
- KEY `c` (`c`),
- KEY `t` (`t`(10)),
- KEY `v` (`v`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-select count(*) from t1 where v='a';
-count(*)
-10
-select count(*) from t1 where v='a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-count(*)
-10
-select count(*) from t1 where v like 'a%';
-count(*)
-11
-select count(*) from t1 where v like 'a %';
-count(*)
-9
-explain select count(*) from t1 where v='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where; Using index
-explain select count(*) from t1 where v like 'a%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 303 NULL # Using where; Using index
-explain select count(*) from t1 where v between 'a' and 'a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where; Using index
-explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using where; Using index
-explain select * from t1 where v='a';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 303 const # Using index condition
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-alter table t1 drop key v, add key v (v(30));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(300) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text,
- KEY `c` (`c`),
- KEY `t` (`t`(10)),
- KEY `v` (`v`(30))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-select count(*) from t1 where v='a';
-count(*)
-10
-select count(*) from t1 where v='a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ';
-count(*)
-10
-select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-count(*)
-10
-select count(*) from t1 where v like 'a%';
-count(*)
-11
-select count(*) from t1 where v like 'a %';
-count(*)
-9
-explain select count(*) from t1 where v='a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-explain select count(*) from t1 where v like 'a%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range v v 33 NULL # Using where
-explain select count(*) from t1 where v between 'a' and 'a ';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-explain select * from t1 where v='a';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref v v 33 const # Using where
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-alter table t1 modify v varchar(600), drop key v, add key v (v);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(600) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text,
- KEY `c` (`c`),
- KEY `t` (`t`(10)),
- KEY `v` (`v`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-select v,count(*) from t1 group by v limit 10;
-v count(*)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-select sql_big_result v,count(t) from t1 group by v limit 10;
-v count(t)
-a 1
-a 10
-b 10
-c 10
-d 10
-e 10
-f 10
-g 10
-h 10
-i 10
-drop table t1;
-create table t1 (a char(10), unique (a));
-insert into t1 values ('a ');
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a' for key 'a'
-alter table t1 modify a varchar(10);
-insert into t1 values ('a '),('a '),('a '),('a ');
-ERROR 23000: Duplicate entry 'a ' for key 'a'
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 'a'
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 'a'
-insert into t1 values ('a ');
-ERROR 23000: Duplicate entry 'a ' for key 'a'
-update t1 set a='a ' where a like 'a%';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-update t1 set a='abc ' where a like 'a ';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-update t1 set a='a ' where a like 'a %';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-update t1 set a='a ' where a like 'a ';
-select concat(a,'.') from t1;
-concat(a,'.')
-a .
-drop table t1;
-create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `t` text,
- KEY `v` (`v`(5)),
- KEY `c` (`c`(5)),
- KEY `t` (`t`(5))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1 (v char(10) character set utf8);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` char(10) CHARACTER SET utf8 DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1 (v varchar(10), c char(10)) row_format=fixed;
-Warnings:
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` varchar(10) DEFAULT NULL,
- `c` char(10) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
-insert into t1 values('a','a'),('a ','a ');
-select concat('*',v,'*',c,'*') from t1;
-concat('*',v,'*',c,'*')
-*a*a*
-*a *a*
-drop table t1;
-create table t1 (v varchar(65530), key(v(10)));
-insert into t1 values(repeat('a',65530));
-select length(v) from t1 where v=repeat('a',65530);
-length(v)
-65530
-drop table t1;
-create table t1(a int, b varchar(12), key ba(b, a));
-insert into t1 values (1, 'A'), (20, NULL);
-explain select * from t1 where a=20 and b is null;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
-select * from t1 where a=20 and b is null;
-a b
-20 NULL
-drop table t1;
-create table t1 (v varchar(65530), key(v));
-Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
-drop table t1;
-create table t1 (v varchar(65536));
-Warnings:
-Note 1246 Converting column 'v' from VARCHAR to TEXT
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` mediumtext
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1 (v varchar(65530) character set utf8);
-Warnings:
-Note 1246 Converting column 'v' from VARCHAR to TEXT
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `v` mediumtext CHARACTER SET utf8
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-set storage_engine=MyISAM;
-create table t1 (v varchar(16384)) engine=innodb;
-drop table t1;
-create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
-insert into t1 values ('8', '6'), ('4', '7');
-select min(a) from t1;
-min(a)
-4
-select min(b) from t1 where a='8';
-min(b)
-6
-drop table t1;
-CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
-insert into t1 (b) values (1);
-replace into t1 (b) values (2), (1), (3);
-select * from t1;
-a b
-3 1
-2 2
-4 3
-truncate table t1;
-insert into t1 (b) values (1);
-replace into t1 (b) values (2);
-replace into t1 (b) values (1);
-replace into t1 (b) values (3);
-select * from t1;
-a b
-3 1
-2 2
-4 3
-drop table t1;
-create table t1 (rowid int not null auto_increment, val int not null,primary
-key (rowid), unique(val)) engine=innodb;
-replace into t1 (val) values ('1'),('2');
-replace into t1 (val) values ('1'),('2');
-insert into t1 (val) values ('1'),('2');
-ERROR 23000: Duplicate entry '1' for key 'val'
-select * from t1;
-rowid val
-3 1
-4 2
-drop table t1;
-create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
-insert into t1 (val) values (1);
-update t1 set a=2 where a=1;
-insert into t1 (val) values (1);
-ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
-select * from t1;
-a val
-2 1
-drop table t1;
-CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
-INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
-SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
-GRADE
-252
-SELECT GRADE FROM t1 WHERE GRADE= 151;
-GRADE
-151
-DROP TABLE t1;
-create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb;
-create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb;
-insert into t2 values ('aa','cc');
-insert into t1 values ('aa','bb'),('aa','cc');
-delete t1 from t1,t2 where f1=f3 and f4='cc';
-select * from t1;
-f1 f2
-drop table t1,t2;
-CREATE TABLE t1 (
-id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
-) ENGINE=InnoDB;
-CREATE TABLE t2 (
-id INTEGER NOT NULL,
-FOREIGN KEY (id) REFERENCES t1 (id)
-) ENGINE=InnoDB;
-INSERT INTO t1 (id) VALUES (NULL);
-SELECT * FROM t1;
-id
-1
-TRUNCATE t1;
-INSERT INTO t1 (id) VALUES (NULL);
-SELECT * FROM t1;
-id
-1
-DELETE FROM t1;
-TRUNCATE t1;
-INSERT INTO t1 (id) VALUES (NULL);
-SELECT * FROM t1;
-id
-1
-DROP TABLE t2, t1;
-CREATE TABLE t1
-(
-id INT PRIMARY KEY
-) ENGINE=InnoDB;
-CREATE TEMPORARY TABLE t2
-(
-id INT NOT NULL PRIMARY KEY,
-b INT,
-FOREIGN KEY (b) REFERENCES test.t1(id)
-) ENGINE=InnoDB;
-Got one of the listed errors
-DROP TABLE t1;
-create table t1 (col1 varchar(2000), index (col1(767)))
-character set = latin1 engine = innodb;
-create table t2 (col1 char(255), index (col1))
-character set = latin1 engine = innodb;
-create table t3 (col1 binary(255), index (col1))
-character set = latin1 engine = innodb;
-create table t4 (col1 varchar(767), index (col1))
-character set = latin1 engine = innodb;
-create table t5 (col1 varchar(767) primary key)
-character set = latin1 engine = innodb;
-create table t6 (col1 varbinary(767) primary key)
-character set = latin1 engine = innodb;
-create table t7 (col1 text, index(col1(767)))
-character set = latin1 engine = innodb;
-create table t8 (col1 blob, index(col1(767)))
-character set = latin1 engine = innodb;
-create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
-character set = latin1 engine = innodb;
-show create table t9;
-Table Create Table
-t9 CREATE TABLE `t9` (
- `col1` varchar(512) DEFAULT NULL,
- `col2` varchar(512) DEFAULT NULL,
- KEY `col1` (`col1`,`col2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
-create table t1 (col1 varchar(768), index(col1))
-character set = latin1 engine = innodb;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
-create table t2 (col1 varbinary(768), index(col1))
-character set = latin1 engine = innodb;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
-create table t3 (col1 text, index(col1(768)))
-character set = latin1 engine = innodb;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
-create table t4 (col1 blob, index(col1(768)))
-character set = latin1 engine = innodb;
-Warnings:
-Warning 1071 Specified key was too long; max key length is 767 bytes
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `col1` varchar(768) DEFAULT NULL,
- KEY `col1` (`col1`(767))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1, t2, t3, t4;
-create table t1 (col1 varchar(768) primary key)
-character set = latin1 engine = innodb;
-ERROR 42000: Specified key was too long; max key length is 767 bytes
-create table t2 (col1 varbinary(768) primary key)
-character set = latin1 engine = innodb;
-ERROR 42000: Specified key was too long; max key length is 767 bytes
-create table t3 (col1 text, primary key(col1(768)))
-character set = latin1 engine = innodb;
-ERROR 42000: Specified key was too long; max key length is 767 bytes
-create table t4 (col1 blob, primary key(col1(768)))
-character set = latin1 engine = innodb;
-ERROR 42000: Specified key was too long; max key length is 767 bytes
-CREATE TABLE t1
-(
-id INT PRIMARY KEY
-) ENGINE=InnoDB;
-CREATE TABLE t2
-(
-v INT,
-CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
-INSERT INTO t1 VALUES(1);
-INSERT INTO t2 VALUES(1);
-DELETE FROM t1 WHERE id = 1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
-DROP TABLE t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
-SET FOREIGN_KEY_CHECKS=0;
-DROP TABLE t1;
-SET FOREIGN_KEY_CHECKS=1;
-INSERT INTO t2 VALUES(3);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
-DROP TABLE t2;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2);
-set autocommit=0;
-checksum table t1;
-Table Checksum
-test.t1 1531596814
-insert into t1 values(3);
-checksum table t1;
-Table Checksum
-test.t1 1531596814
-commit;
-checksum table t1;
-Table Checksum
-test.t1 2050879373
-commit;
-drop table t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2);
-set autocommit=1;
-checksum table t1;
-Table Checksum
-test.t1 1531596814
-set autocommit=1;
-insert into t1 values(3);
-checksum table t1;
-Table Checksum
-test.t1 2050879373
-drop table t1;
-set foreign_key_checks=0;
-create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
-create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
-ERROR HY000: Can't create table 'test.t1' (errno: 150)
-set foreign_key_checks=1;
-drop table t2;
-set foreign_key_checks=0;
-create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
-create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
-ERROR HY000: Can't create table 'test.t2' (errno: 150)
-set foreign_key_checks=1;
-drop table t1;
-set foreign_key_checks=0;
-create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
-create table t1(a varchar(10) primary key) engine = innodb;
-alter table t1 modify column a int;
-Got one of the listed errors
-set foreign_key_checks=1;
-drop table t2,t1;
-set foreign_key_checks=0;
-create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
-create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
-alter table t1 convert to character set utf8;
-set foreign_key_checks=1;
-drop table t2,t1;
-set foreign_key_checks=0;
-create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
-create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
-rename table t3 to t1;
-ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150)
-set foreign_key_checks=1;
-drop table t2,t3;
-create table t1(a int primary key) row_format=redundant engine=innodb;
-create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
-create table t3(a int primary key) row_format=compact engine=innodb;
-create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
-insert into t1 values(1);
-insert into t3 values(1);
-insert into t2 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
-insert into t4 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
-insert into t2 values(1);
-insert into t4 values(1);
-update t1 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
-update t2 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
-update t3 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
-update t4 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
-truncate t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
-truncate t3;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
-truncate t2;
-truncate t4;
-truncate t1;
-truncate t3;
-drop table t4,t3,t2,t1;
-create table t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-key (a,b,c,d)) engine=innodb;
-drop table t1;
-create table t1 (a varchar(255) character set utf8,
-b varchar(255) character set utf8,
-c varchar(255) character set utf8,
-d varchar(255) character set utf8,
-e varchar(255) character set utf8,
-key (a,b,c,d,e)) engine=innodb;
-ERROR 42000: Specified key was too long; max key length is 3072 bytes
-create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
-create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
-create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
-create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
-insert into t1 values (0x41),(0x4120),(0x4100);
-insert into t2 values (0x41),(0x4120),(0x4100);
-ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
-insert into t2 values (0x41),(0x4120);
-insert into t3 values (0x41),(0x4120),(0x4100);
-ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
-insert into t3 values (0x41),(0x4100);
-insert into t4 values (0x41),(0x4120),(0x4100);
-ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
-insert into t4 values (0x41),(0x4100);
-select hex(s1) from t1;
-hex(s1)
-41
-4100
-4120
-select hex(s1) from t2;
-hex(s1)
-4100
-4120
-select hex(s1) from t3;
-hex(s1)
-4100
-41
-select hex(s1) from t4;
-hex(s1)
-4100
-41
-drop table t1,t2,t3,t4;
-create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
-create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
-insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
-insert into t2 values(0x42);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-insert into t2 values(0x41);
-select hex(s1) from t2;
-hex(s1)
-4100
-update t1 set s1=0x123456 where a=2;
-select hex(s1) from t2;
-hex(s1)
-4100
-update t1 set s1=0x12 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-update t1 set s1=0x12345678 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-update t1 set s1=0x123457 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-update t1 set s1=0x1220 where a=1;
-select hex(s1) from t2;
-hex(s1)
-1220
-update t1 set s1=0x1200 where a=1;
-select hex(s1) from t2;
-hex(s1)
-1200
-update t1 set s1=0x4200 where a=1;
-select hex(s1) from t2;
-hex(s1)
-4200
-delete from t1 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-delete from t1 where a=2;
-update t2 set s1=0x4120;
-delete from t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-delete from t1 where a!=3;
-select a,hex(s1) from t1;
-a hex(s1)
-3 4120
-select hex(s1) from t2;
-hex(s1)
-4120
-drop table t2,t1;
-create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
-create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
-insert into t1 values(1,0x4100),(2,0x41);
-insert into t2 values(0x41);
-select hex(s1) from t2;
-hex(s1)
-41
-update t1 set s1=0x1234 where a=1;
-select hex(s1) from t2;
-hex(s1)
-41
-update t1 set s1=0x12 where a=2;
-select hex(s1) from t2;
-hex(s1)
-12
-delete from t1 where a=1;
-delete from t1 where a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
-select a,hex(s1) from t1;
-a hex(s1)
-2 12
-select hex(s1) from t2;
-hex(s1)
-12
-drop table t2,t1;
-CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
-CREATE TABLE t2(a INT) ENGINE=InnoDB;
-ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
-ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
-ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
-ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) DEFAULT NULL,
- KEY `t2_ibfk_0` (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2,t1;
-create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
-insert into t1(a) values (1),(2),(3);
-commit;
-set autocommit = 0;
-update t1 set b = 5 where a = 2;
-create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
-set autocommit = 0;
-insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
-(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
-(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
-(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
-(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
-commit;
-commit;
-drop trigger t1t;
-drop table t1;
-create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
-create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
-create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
-create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
-create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
-insert into t1(a) values (1),(2),(3);
-insert into t2(a) values (1),(2),(3);
-insert into t3(a) values (1),(2),(3);
-insert into t4(a) values (1),(2),(3);
-insert into t3(a) values (5),(7),(8);
-insert into t4(a) values (5),(7),(8);
-insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
-create trigger t1t before insert on t1 for each row begin
-INSERT INTO t2 SET a = NEW.a;
-end |
-create trigger t2t before insert on t2 for each row begin
-DELETE FROM t3 WHERE a = NEW.a;
-end |
-create trigger t3t before delete on t3 for each row begin
-UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
-end |
-create trigger t4t before update on t4 for each row begin
-UPDATE t5 SET b = b + 1 where a = NEW.a;
-end |
-commit;
-set autocommit = 0;
-update t1 set b = b + 5 where a = 1;
-update t2 set b = b + 5 where a = 1;
-update t3 set b = b + 5 where a = 1;
-update t4 set b = b + 5 where a = 1;
-insert into t5(a) values(20);
-set autocommit = 0;
-insert into t1(a) values(7);
-insert into t2(a) values(8);
-delete from t2 where a = 3;
-update t4 set b = b + 1 where a = 3;
-commit;
-drop trigger t1t;
-drop trigger t2t;
-drop trigger t3t;
-drop trigger t4t;
-drop table t1, t2, t3, t4, t5;
-CREATE TABLE t1 (
-field1 varchar(8) NOT NULL DEFAULT '',
-field2 varchar(8) NOT NULL DEFAULT '',
-PRIMARY KEY (field1, field2)
-) ENGINE=InnoDB;
-CREATE TABLE t2 (
-field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
-FOREIGN KEY (field1) REFERENCES t1 (field1)
-ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('old', 'somevalu');
-INSERT INTO t1 VALUES ('other', 'anyvalue');
-INSERT INTO t2 VALUES ('old');
-INSERT INTO t2 VALUES ('other');
-UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
-ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
-DROP TABLE t2;
-DROP TABLE t1;
-create table t1 (
-c1 bigint not null,
-c2 bigint not null,
-primary key (c1),
-unique key (c2)
-) engine=innodb;
-create table t2 (
-c1 bigint not null,
-primary key (c1)
-) engine=innodb;
-alter table t1 add constraint c2_fk foreign key (c2)
-references t2(c1) on delete cascade;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c1` bigint(20) NOT NULL,
- `c2` bigint(20) NOT NULL,
- PRIMARY KEY (`c1`),
- UNIQUE KEY `c2` (`c2`),
- CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 drop foreign key c2_fk;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c1` bigint(20) NOT NULL,
- `c2` bigint(20) NOT NULL,
- PRIMARY KEY (`c1`),
- UNIQUE KEY `c2` (`c2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1, t2;
-create table t1(a date) engine=innodb;
-create table t2(a date, key(a)) engine=innodb;
-insert into t1 values('2005-10-01');
-insert into t2 values('2005-10-01');
-select * from t1, t2
-where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
-a a
-2005-10-01 2005-10-01
-drop table t1, t2;
-create table t1 (id int not null, f_id int not null, f int not null,
-primary key(f_id, id)) engine=innodb;
-create table t2 (id int not null,s_id int not null,s varchar(200),
-primary key(id)) engine=innodb;
-INSERT INTO t1 VALUES (8, 1, 3);
-INSERT INTO t1 VALUES (1, 2, 1);
-INSERT INTO t2 VALUES (1, 0, '');
-INSERT INTO t2 VALUES (8, 1, '');
-commit;
-DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
-WHERE mm.id IS NULL;
-select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
-where mm.id is null lock in share mode;
-id f_id f
-drop table t1,t2;
-create table t1(a int not null, b int, primary key(a)) engine=innodb;
-insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
-commit;
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-update t1 set b = 5 where b = 1;
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-select * from t1 where a = 7 and b = 3 for update;
-a b
-7 3
-commit;
-commit;
-drop table t1;
-create table t1(a int not null, b int, primary key(a)) engine=innodb;
-insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
-commit;
-set autocommit = 0;
-select * from t1 lock in share mode;
-a b
-1 1
-2 2
-3 1
-4 2
-5 1
-6 2
-update t1 set b = 5 where b = 1;
-set autocommit = 0;
-select * from t1 where a = 2 and b = 2 for update;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-commit;
-drop table t1;
-create table t1(a int not null, b int, primary key(a)) engine=innodb;
-insert into t1 values (1,2),(5,3),(4,2);
-create table t2(d int not null, e int, primary key(d)) engine=innodb;
-insert into t2 values (8,6),(12,1),(3,1);
-commit;
-set autocommit = 0;
-select * from t2 for update;
-d e
-3 1
-8 6
-12 1
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-insert into t1 select * from t2;
-update t1 set b = (select e from t2 where a = d);
-create table t3(d int not null, e int, primary key(d)) engine=innodb
-select * from t2;
-commit;
-commit;
-drop table t1, t2, t3;
-create table t1(a int not null, b int, primary key(a)) engine=innodb;
-insert into t1 values (1,2),(5,3),(4,2);
-create table t2(a int not null, b int, primary key(a)) engine=innodb;
-insert into t2 values (8,6),(12,1),(3,1);
-create table t3(d int not null, b int, primary key(d)) engine=innodb;
-insert into t3 values (8,6),(12,1),(3,1);
-create table t5(a int not null, b int, primary key(a)) engine=innodb;
-insert into t5 values (1,2),(5,3),(4,2);
-create table t6(d int not null, e int, primary key(d)) engine=innodb;
-insert into t6 values (8,6),(12,1),(3,1);
-create table t8(a int not null, b int, primary key(a)) engine=innodb;
-insert into t8 values (1,2),(5,3),(4,2);
-create table t9(d int not null, e int, primary key(d)) engine=innodb;
-insert into t9 values (8,6),(12,1),(3,1);
-commit;
-set autocommit = 0;
-select * from t2 for update;
-a b
-3 1
-8 6
-12 1
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-insert into t1 select * from t2;
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-update t3 set b = (select b from t2 where a = d);
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-insert into t5 (select * from t2 lock in share mode);
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-update t6 set e = (select b from t2 where a = d lock in share mode);
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-insert into t8 (select * from t2 for update);
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-update t9 set e = (select b from t2 where a = d for update);
-SET binlog_format='MIXED';
-set autocommit = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-drop table t1, t2, t3, t5, t6, t8, t9;
-CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
-ERROR 42000: Incorrect column name 'DB_ROW_ID'
-CREATE TABLE t1 (
-a BIGINT(20) NOT NULL,
-PRIMARY KEY (a)
-) ENGINE=INNODB DEFAULT CHARSET=UTF8;
-CREATE TABLE t2 (
-a BIGINT(20) NOT NULL,
-b VARCHAR(128) NOT NULL,
-c TEXT NOT NULL,
-PRIMARY KEY (a,b),
-KEY idx_t2_b_c (b,c(200)),
-CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
-ON DELETE CASCADE
-) ENGINE=INNODB DEFAULT CHARSET=UTF8;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1, 'bar', 'vbar');
-INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
-INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
-INSERT INTO t2 VALUES (1, 'customer_over', '1');
-SELECT * FROM t2 WHERE b = 'customer_over';
-a b c
-1 customer_over 1
-SELECT * FROM t2 WHERE BINARY b = 'customer_over';
-a b c
-1 customer_over 1
-SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
-a
-1
-/* Bang: Empty result set, above was expected: */
-SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
-a
-1
-SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
-a
-1
-drop table t2, t1;
-CREATE TABLE t1 ( a int ) ENGINE=innodb;
-BEGIN;
-INSERT INTO t1 VALUES (1);
-OPTIMIZE TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize status OK
-DROP TABLE t1;
-CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
-CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL,
-CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id)
-ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
-ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON
-DELETE CASCADE ON UPDATE CASCADE;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `id` int(11) NOT NULL,
- `f` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `f` (`f`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2, t1;
-CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
-CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1);
-ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
-ALTER TABLE t2 MODIFY a INT NOT NULL;
-ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
-DELETE FROM t1;
-DROP TABLE t2,t1;
-CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
-AUTO_INCREMENT=42;
-INSERT INTO t1 VALUES (0),(347),(0);
-SELECT * FROM t1;
-id
-42
-347
-348
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
-CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t2 VALUES(42),(347),(348);
-ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`id`),
- CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
-DROP TABLE t1,t2;
-set innodb_strict_mode=on;
-CREATE TABLE t1 (
-c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
-c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
-c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
-c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
-c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
-c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
-c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
-c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
-) ENGINE = InnoDB;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 't1'
-CREATE TABLE t1(
-id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(-10);
-SELECT * FROM t1;
-id
--10
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
-id
--10
-1
-DROP TABLE t1;
-SET binlog_format='MIXED';
-SET TX_ISOLATION='read-committed';
-SET AUTOCOMMIT=0;
-DROP TABLE IF EXISTS t1, t2;
-Warnings:
-Note 1051 Unknown table 't1'
-Note 1051 Unknown table 't2'
-CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
-CREATE TABLE t2 LIKE t1;
-SELECT * FROM t2;
-a
-SET binlog_format='MIXED';
-SET TX_ISOLATION='read-committed';
-SET AUTOCOMMIT=0;
-INSERT INTO t1 VALUES (1);
-COMMIT;
-SELECT * FROM t1 WHERE a=1;
-a
-1
-SET binlog_format='MIXED';
-SET TX_ISOLATION='read-committed';
-SET AUTOCOMMIT=0;
-SELECT * FROM t2;
-a
-SET binlog_format='MIXED';
-SET TX_ISOLATION='read-committed';
-SET AUTOCOMMIT=0;
-INSERT INTO t1 VALUES (2);
-COMMIT;
-SELECT * FROM t1 WHERE a=2;
-a
-2
-SELECT * FROM t1 WHERE a=2;
-a
-2
-DROP TABLE t1;
-DROP TABLE t2;
-create table t1 (i int, j int) engine=innodb;
-insert into t1 (i, j) values (1, 1), (2, 2);
-update t1 set j = 2;
-affected rows: 1
-info: Rows matched: 2 Changed: 1 Warnings: 0
-drop table t1;
-create table t1 (id int) comment='this is a comment' engine=innodb;
-select table_comment, data_free > 0 as data_free_is_set
-from information_schema.tables
-where table_schema='test' and table_name = 't1';
-table_comment data_free_is_set
-this is a comment 1
-drop table t1;
-CREATE TABLE t1 (
-c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-c2 VARCHAR(128) NOT NULL,
-PRIMARY KEY(c1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100;
-CREATE TABLE t2 (
-c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
-c2 INT(10) UNSIGNED DEFAULT NULL,
-PRIMARY KEY(c1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200;
-SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
-AUTO_INCREMENT
-200
-ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1);
-SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
-AUTO_INCREMENT
-200
-DROP TABLE t2;
-DROP TABLE t1;
-CREATE TABLE t1 (c1 int default NULL,
-c2 int default NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-TRUNCATE TABLE t1;
-affected rows: 0
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
-affected rows: 5
-info: Records: 5 Duplicates: 0 Warnings: 0
-TRUNCATE TABLE t1;
-affected rows: 0
-DROP TABLE t1;
-Variable_name Value
-Handler_update 0
-Variable_name Value
-Handler_delete 0
-Variable_name Value
-Handler_update 1
-Variable_name Value
-Handler_delete 1
diff --git a/mysql-test/r/innodb_bug36172.result b/mysql-test/r/innodb_bug36172.result
deleted file mode 100644
index 195775f74c8..00000000000
--- a/mysql-test/r/innodb_bug36172.result
+++ /dev/null
@@ -1 +0,0 @@
-SET storage_engine=InnoDB;
diff --git a/mysql-test/r/innodb_bug47167.result b/mysql-test/r/innodb_bug47167.result
deleted file mode 100644
index cbec363d78f..00000000000
--- a/mysql-test/r/innodb_bug47167.result
+++ /dev/null
@@ -1,24 +0,0 @@
-set @old_innodb_file_format_check=@@innodb_file_format_check;
-select @old_innodb_file_format_check;
-@old_innodb_file_format_check
-Antelope
-set global innodb_file_format_check = Barracuda;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format_check = DEFAULT;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format_check = @old_innodb_file_format_check;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Antelope
-set global innodb_file_format_check = cheetah;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format_check = Bear;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format_check = on;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format_check = off;
-ERROR HY000: Incorrect arguments to SET
diff --git a/mysql-test/r/innodb_file_format.result b/mysql-test/r/innodb_file_format.result
deleted file mode 100644
index d58c4ce8b28..00000000000
--- a/mysql-test/r/innodb_file_format.result
+++ /dev/null
@@ -1,44 +0,0 @@
-call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value");
-select @@innodb_file_format;
-@@innodb_file_format
-Antelope
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Antelope
-set global innodb_file_format=antelope;
-set global innodb_file_format=barracuda;
-set global innodb_file_format=cheetah;
-ERROR HY000: Incorrect arguments to SET
-select @@innodb_file_format;
-@@innodb_file_format
-Barracuda
-set global innodb_file_format=default;
-select @@innodb_file_format;
-@@innodb_file_format
-Antelope
-set global innodb_file_format=on;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=off;
-ERROR HY000: Incorrect arguments to SET
-select @@innodb_file_format;
-@@innodb_file_format
-Antelope
-set global innodb_file_format_check=antelope;
-set global innodb_file_format_check=barracuda;
-set global innodb_file_format_check=cheetah;
-ERROR HY000: Incorrect arguments to SET
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format_check=default;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format=on;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=off;
-ERROR HY000: Incorrect arguments to SET
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format_check=antelope;
diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index 5437538023c..4e0ae5bf640 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -4114,6 +4114,9 @@ FROM t1 JOIN t2 ON t2.v
ORDER BY t2.v;
MAX(t1.i)
NULL
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect INTEGER value: 'y'
EXPLAIN
SELECT MAX(t1.i)
diff --git a/mysql-test/r/join_optimizer.result b/mysql-test/r/join_optimizer.result
index 9e667506cfa..42c4c220e8c 100644
--- a/mysql-test/r/join_optimizer.result
+++ b/mysql-test/r/join_optimizer.result
@@ -33,5 +33,5 @@ SELECT STRAIGHT_JOIN g.id FROM t2 a, t3 g USE INDEX(groups_dt)
WHERE g.domain = 'queue' AND g.type = a.type;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE a ALL NULL NULL NULL NULL 2
-1 SIMPLE g ref groups_dt groups_dt 70 const,test.a.type 13 Using where
+1 SIMPLE g ref groups_dt groups_dt 70 const,test.a.type 13 Using index condition
drop table t0,t1,t2,t3;
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index 2f8a6ae93e0..b4a9bc7c4c2 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -946,25 +946,29 @@ group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
-Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
+Warning 1260 Row 2 was cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
-Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
+Warning 1260 Row 2 was cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
-Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
+Warning 1260 Row 2 was cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
-Warning 1260 2 line(s) were cut by GROUP_CONCAT()
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
+Warning 1260 Row 2 was cut by GROUP_CONCAT()
drop table t1, t2;
set group_concat_max_len=default;
create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key (gid,x,y));
@@ -1238,6 +1242,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 5
+Handler_read_last 0
Handler_read_next 9
Handler_read_prev 0
Handler_read_rnd 3
@@ -1306,7 +1311,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
+Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
f1 f2 f3 f1 f2
diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result
index b6341109556..62539566bfa 100644
--- a/mysql-test/r/log_slow.result
+++ b/mysql-test/r/log_slow.result
@@ -1,6 +1,6 @@
select @@log_slow_filter;
@@log_slow_filter
-
+admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
select @@log_slow_rate_limit;
@@log_slow_rate_limit
1
@@ -9,10 +9,9 @@ select @@log_slow_verbosity;
show variables like "log_slow%";
Variable_name Value
-log_slow_filter
+log_slow_filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
log_slow_queries ON
log_slow_rate_limit 1
-log_slow_time 10.000000
log_slow_verbosity
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
select @@log_slow_filter;
@@ -56,6 +55,6 @@ last_insert_id int(11) NO NULL
insert_id int(11) NO NULL
server_id int(10) unsigned NO NULL
sql_text mediumtext NO NULL
-flush slow query logs;
+flush slow logs;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result
index a9d1b41cf2c..850bdf5c2bd 100644
--- a/mysql-test/r/log_tables_upgrade.result
+++ b/mysql-test/r/log_tables_upgrade.result
@@ -41,6 +41,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
diff --git a/mysql-test/r/merge_debug.result b/mysql-test/r/merge_debug.result
index b857ff597f2..869d9e7536c 100644
--- a/mysql-test/r/merge_debug.result
+++ b/mysql-test/r/merge_debug.result
@@ -10,11 +10,11 @@ INSERT INTO crashed VALUES (10);
INSERT INTO t2 VALUES (20);
INSERT INTO t3 VALUES (30);
LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, crashed WRITE;
-SET GLOBAL debug="+d,*,myisam_pretend_crashed_table_on_open";
+SET GLOBAL debug="+d,myisam_pretend_crashed_table_on_open";
CREATE TRIGGER t1_ai AFTER INSERT ON crashed FOR EACH ROW INSERT INTO t2 VALUES(29);
SET GLOBAL debug=@orig_debug;
INSERT INTO t4 VALUES (39);
-ERROR HY000: Table 't4' was not locked with LOCK TABLES
+ERROR HY000: Table 'crashed' was not locked with LOCK TABLES
INSERT INTO crashed VALUES (11);
ERROR HY000: Table 'crashed' was not locked with LOCK TABLES
INSERT INTO t2 VALUES (21);
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 06e345304de..dea4f2c1230 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -2258,7 +2258,7 @@ Key Start Len Index Type
DROP TABLE t1;
create table t1 (n int not null, c char(1)) transactional=1;
Warnings:
-Error 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
+Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index c727e3b5b5a..7737dab49b2 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -28,6 +28,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
@@ -63,6 +64,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
@@ -98,6 +100,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
@@ -136,6 +139,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
@@ -177,6 +181,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
@@ -221,6 +226,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
test
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK
@@ -231,3 +237,5 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched.
+Phase 3/3: Running 'mysql_fix_privilege_tables'...
+OK
diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result
index f1229c4a405..23ad09dbd9c 100644
--- a/mysql-test/r/mysql_upgrade_ssl.result
+++ b/mysql-test/r/mysql_upgrade_ssl.result
@@ -1,15 +1,18 @@
#
# Bug#55672 mysql_upgrade dies with internal error
#
+Phase 1/3: Fixing table and database names
+Phase 2/3: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
+mysql
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
-mysql.general_log
-Error : You can't use locks with log tables.
-status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
@@ -20,9 +23,6 @@ mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
-mysql.slow_log
-Error : You can't use locks with log tables.
-status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
@@ -30,3 +30,7 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+performance_schema
+test
+Phase 3/3: Running 'mysql_fix_privilege_tables'...
+OK
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 025f67082ec..8cd8dc2b0dd 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -97,6 +97,16 @@ The following options may be given as the first argument:
--date-format=name The DATE format (ignored)
--datetime-format=name
The DATETIME format (ignored)
+ --deadlock-search-depth-long=#
+ Long search depth for the two-step deadlock detection
+ --deadlock-search-depth-short=#
+ Short search depth for the two-step deadlock detection
+ --deadlock-timeout-long=#
+ Long timeout for the two-step deadlock detection (in
+ microseconds)
+ --deadlock-timeout-short=#
+ Short timeout for the two-step deadlock detection (in
+ microseconds)
--default-storage-engine=name
The default storage engine for new tables
--default-time-zone=name
@@ -141,6 +151,11 @@ The following options may be given as the first argument:
With this option enabled you can run myisamchk to test
(not repair) tables while the MySQL server is running.
Disable with --skip-external-locking.
+ --extra-max-connections=#
+ The number of connections on extra-port
+ --extra-port=# Extra port number to use for tcp connections in a
+ one-thread-per-connection manner. 0 means don't use
+ another port
--flush Flush MyISAM tables to disk between SQL commands
--flush-time=# A dedicated thread is created to flush all tables at the
given interval
@@ -180,6 +195,10 @@ The following options may be given as the first argument:
interactive connection before closing it
--join-buffer-size=#
The size of the buffer that is used for full joins
+ --join-cache-level=#
+ Controls what join operations can be executed with join
+ buffers. Odd numbers are used for plain join buffers
+ while even numbers are used for linked buffers
--keep-files-on-create
Don't overwrite stale .MYD and .MYI even if no directory
is specified
@@ -197,6 +216,8 @@ The following options may be given as the first argument:
The default size of key cache blocks
--key-cache-division-limit=#
The minimum percentage of warm blocks in key cache
+ --key-cache-segments=#
+ The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as
a full path. Deprecated. Use --lc-messages-dir instead.
--large-pages Enable support for large pages
@@ -243,15 +264,28 @@ The following options may be given as the first argument:
--log-slow-admin-statements
Log slow OPTIMIZE, ANALYZE, ALTER and other
administrative statements to the slow log if it is open.
+ --log-slow-filter=name
+ Log only certain types of queries. Multiple flags can be
+ specified, separated by commas. Valid values are admin,
+ slave, filesort, filesort_on_disk, full_join, full_scan,
+ query_cache, query_cache_miss, tmp_table,
+ tmp_table_on_disk
--log-slow-queries[=name]
Log slow queries to a table or log file. Defaults logging
to table mysql.slow_log or hostname-slow.log if
--log-output=file is used. Must be enabled to activate
other slow log options. Deprecated option, use
--slow-query-log/--slow-query-log-file instead.
+ --log-slow-rate-limit=#
+ Write to slow log every #th slow query. Set to 1 to log
+ everything. Increase it to reduce the size of the slow or
+ the performance impact of slow logging
--log-slow-slave-statements
Log slow statements executed by slave thread to the slow
log if it is open.
+ --log-slow-verbosity=name
+ log-slow-verbosity=[value[,value ...]] where value is one
+ of 'innodb', 'query_plan'
--log-tc=name Path to transaction coordinator log (used for
transactions that affect more than one storage engine,
when binary log is disabled).
@@ -327,8 +361,7 @@ The following options may be given as the first argument:
--min-examined-row-limit=#
Don't write queries to slow log that examine fewer rows
than that
- --multi-range-count=#
- Number of key ranges to request at once
+ --mrr-buffer-size=# Size of buffer to use when using MRR with range access
--myisam-block-size=#
Block size to be used for MyISAM index pages
--myisam-data-pointer-size=#
@@ -404,8 +437,15 @@ The following options may be given as the first argument:
optimizer_switch=option=val[,option=val...], where option
is one of {index_merge, index_merge_union,
index_merge_sort_union, index_merge_intersection,
- engine_condition_pushdown} and val is one of {on, off,
- default}
+ engine_condition_pushdown, index_condition_pushdown,
+ firstmatch, loosescan, materialization, semijoin,
+ partial_match_rowid_merge, partial_match_table_scan,
+ subquery_cache} and val is one of {on, off, default}
+ --optimizer-use-mrr=name
+ Whether the server should use multi-read-range
+ optimization when resolving queries, one of AUTO (as
+ appropriate), FORCE (always where applicable), DISABLE
+ (never)
--performance-schema
Enable the performance schema.
--performance-schema-events-waits-history-long-size=#
@@ -444,6 +484,9 @@ The following options may be given as the first argument:
where each plugin is identified as name=library, where
name is the plugin name and library is the plugin library
in plugin_dir.
+ --plugin-maturity=name
+ The lowest desirable plugin maturity. Plugins less mature
+ than that will not be installed or loaded.
-P, --port=# Port number to use for connection or 0 to default to,
my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default
(3306), whatever comes first
@@ -578,6 +621,9 @@ The following options may be given as the first argument:
not sure, leave this option unset
--report-user=name The account user name of the slave to be reported to the
master during slave registration
+ --rowid-merge-buff-size=#
+ The size of the buffers used [NOT] IN evaluation via
+ partial matching
--rpl-recovery-rank=#
Unused, will be removed
--safe-mode Skip some optimize stages (for testing).
@@ -593,13 +639,14 @@ The following options may be given as the first argument:
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
+ --skip-bdb Deprecated option; Exist only for compatiblity with old
+ my.cnf files
--skip-grant-tables Start without grant tables. This gives all users FULL
ACCESS to all tables.
--skip-host-cache Don't cache host names.
--skip-name-resolve Don't resolve hostnames. All hostnames are IP's or
'localhost'.
--skip-networking Don't allow connection with TCP/IP
- --skip-new Don't use new, possibly wrong routines.
--skip-show-database
Don't allow 'SHOW DATABASE' commands
--skip-slave-start If set, slave is not autostarted.
@@ -688,14 +735,14 @@ The following options may be given as the first argument:
How many threads we should keep in a cache for reuse
--thread-handling=name
Define threads usage for handling queries, one of
- one-thread-per-connection, no-threads, loaded-dynamically
+ one-thread-per-connection, no-threads
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
currently supported)
--tmp-table-size=# If an internal in-memory temporary table exceeds this
size, MySQL will automatically convert it to an on-disk
- MyISAM table
+ MyISAM or Aria table
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
separated by a colon (:), in this case they are used in a
round-robin fashion
@@ -715,6 +762,9 @@ The following options may be given as the first argument:
of the underlying table and the query uses a LIMIT clause
(usually get from GUI tools)
-u, --user=name Run mysqld daemon as user.
+ --userstat Enables statistics gathering for USER_STATISTICS,
+ CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS
+ tables in the INFORMATION_SCHEMA
-v, --verbose Used with --help option for detailed help.
-V, --version Output version information and exit.
--wait-timeout=# The number of seconds the server waits for activity on a
@@ -746,7 +796,11 @@ connect-timeout 10
console FALSE
date-format %Y-%m-%d
datetime-format %Y-%m-%d %H:%i:%s
-default-storage-engine InnoDB
+deadlock-search-depth-long 15
+deadlock-search-depth-short 4
+deadlock-timeout-long 50000000
+deadlock-timeout-short 10000
+default-storage-engine myisam
default-time-zone (No default value)
default-week-format 0
delay-key-write ON
@@ -759,6 +813,8 @@ engine-condition-pushdown TRUE
event-scheduler OFF
expire-logs-days 0
external-locking FALSE
+extra-max-connections 1
+extra-port 0
flush FALSE
flush-time 0
ft-boolean-syntax + -><()~*:""&|
@@ -777,11 +833,13 @@ init-rpl-role MASTER
init-slave
interactive-timeout 28800
join-buffer-size 131072
+join-cache-level 1
keep-files-on-create FALSE
-key-buffer-size 8388608
+key-buffer-size 134217728
key-cache-age-threshold 300
key-cache-block-size 1024
key-cache-division-limit 100
+key-cache-segments 0
language MYSQL_SHAREDIR/
large-pages FALSE
lc-messages en_US
@@ -799,7 +857,10 @@ log-queries-not-using-indexes FALSE
log-short-format FALSE
log-slave-updates FALSE
log-slow-admin-statements FALSE
+log-slow-filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
+log-slow-rate-limit 1
log-slow-slave-statements FALSE
+log-slow-verbosity
log-tc tc.log
log-tc-size 24576
log-warnings 1
@@ -829,12 +890,12 @@ max-user-connections 0
max-write-lock-count 18446744073709551615
memlock FALSE
min-examined-row-limit 0
-multi-range-count 256
+mrr-buffer-size 262144
myisam-block-size 1024
myisam-data-pointer-size 6
myisam-max-sort-file-size 9223372036853727232
myisam-mmap-size 18446744073709551615
-myisam-recover-options OFF
+myisam-recover-options DEFAULT
myisam-repair-threads 1
myisam-sort-buffer-size 8388608
myisam-stats-method nulls_unequal
@@ -850,7 +911,8 @@ old-passwords FALSE
old-style-user-limits FALSE
optimizer-prune-level 1
optimizer-search-depth 62
-optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on
+optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,table_elimination=on
+optimizer-use-mrr force
performance-schema FALSE
performance-schema-events-waits-history-long-size 10000
performance-schema-events-waits-history-size 10
@@ -868,6 +930,7 @@ performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
performance-schema-max-thread-instances 1000
plugin-load (No default value)
+plugin-maturity unknown
port 3306
port-open-timeout 0
preload-buffer-size 32768
@@ -894,6 +957,7 @@ report-host (No default value)
report-password (No default value)
report-port 3306
report-user (No default value)
+rowid-merge-buff-size 8388608
rpl-recovery-rank 0
safe-user-create FALSE
secure-auth FALSE
@@ -919,7 +983,7 @@ sporadic-binlog-dump-fail FALSE
sql-mode
symbolic-links FALSE
sync-binlog 0
-sync-frm TRUE
+sync-frm FALSE
sync-master-info 0
sync-relay-log 0
sync-relay-log-info 0
@@ -930,7 +994,7 @@ table-open-cache 400
tc-heuristic-recover COMMIT
thread-cache-size 0
thread-handling one-thread-per-connection
-thread-stack 262144
+thread-stack 294912
time-format %H:%i:%s
timed-mutexes FALSE
tmp-table-size 16777216
@@ -938,6 +1002,7 @@ transaction-alloc-block-size 8192
transaction-isolation REPEATABLE-READ
transaction-prealloc-size 4096
updatable-views-with-limit YES
+userstat FALSE
verbose TRUE
wait-timeout 28800
diff --git a/mysql-test/r/not_partition.result b/mysql-test/r/not_partition.result
index 2c48f56d578..3c0523279a9 100644
--- a/mysql-test/r/not_partition.result
+++ b/mysql-test/r/not_partition.result
@@ -3,7 +3,7 @@ FLUSH TABLES;
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'partition'
TRUNCATE TABLE t1;
-ERROR 42000: Unknown storage engine 'partition'
+ERROR 42S02: Table 'test.t1' doesn't exist
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze Error Unknown storage engine 'partition'
diff --git a/mysql-test/r/optimizer_switch.result b/mysql-test/r/optimizer_switch.result
deleted file mode 100644
index 6bccefe54be..00000000000
--- a/mysql-test/r/optimizer_switch.result
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Generic @@optimizer_switch tests
-#
-#
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='index_merge=off,index_merge_union=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='index_merge_union=on';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,index_merge_sort_union=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch=4;
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of '4'
-set optimizer_switch=NULL;
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'NULL'
-set optimizer_switch='default,index_merge';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge'
-set optimizer_switch='index_merge=index_merge';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=index_merge'
-set optimizer_switch='index_merge=on,but...';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'but...'
-set optimizer_switch='index_merge=';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge='
-set optimizer_switch='index_merge';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge'
-set optimizer_switch='on';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'on'
-set optimizer_switch='index_merge=on,index_merge=off';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=off'
-set optimizer_switch='index_merge_union=on,index_merge_union=default';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge_union=default'
-set optimizer_switch='default,index_merge=on,index_merge=off,default';
-ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=off,default'
-set optimizer_switch=default;
-set optimizer_switch='index_merge=off,index_merge_union=off,default';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch=default;
-select @@global.optimizer_switch;
-@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set @@global.optimizer_switch=default;
-select @@global.optimizer_switch;
-@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-#
-# Check index_merge's @@optimizer_switch flags
-#
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-
-BUG#37120 optimizer_switch allowable values not according to specification
-
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,materialization=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,semijoin=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,loosescan=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,semijoin=off,materialization=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,materialization=off,semijoin=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=off,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,semijoin=off,materialization=off,loosescan=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=off,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,semijoin=off,loosescan=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch='default,materialization=off,loosescan=off';
-select @@optimizer_switch;
-@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_condition_pushdown=on,firstmatch=on,loosescan=off,materialization=off,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on
-set optimizer_switch=default;
diff --git a/mysql-test/r/optimizer_switch_eng_cond_pushdown1.result b/mysql-test/r/optimizer_switch_eng_cond_pushdown1.result
index a8313ec246c..ac69da6ebb5 100644
--- a/mysql-test/r/optimizer_switch_eng_cond_pushdown1.result
+++ b/mysql-test/r/optimizer_switch_eng_cond_pushdown1.result
@@ -2,4 +2,4 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-1 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on
+1 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,table_elimination=on
diff --git a/mysql-test/r/optimizer_switch_eng_cond_pushdown2.result b/mysql-test/r/optimizer_switch_eng_cond_pushdown2.result
index d7e84c57f42..2d67cebbe3c 100644
--- a/mysql-test/r/optimizer_switch_eng_cond_pushdown2.result
+++ b/mysql-test/r/optimizer_switch_eng_cond_pushdown2.result
@@ -2,4 +2,4 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,table_elimination=on index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=off,index_condition_pushdown=on,firstmatch=on,loosescan=on,materialization=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,table_elimination=on
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 148504bcc8b..bbd69083038 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -5,6 +5,8 @@ drop table if exists t1, t2;
#
SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency;
SET GLOBAL innodb_thread_concurrency = 1;
+set global default_storage_engine='innodb';
+set session default_storage_engine='innodb';
CREATE TABLE t1
(user_num BIGINT,
hours SMALLINT,
@@ -489,3 +491,4 @@ Warning 1265 Data truncated for column 'b' at row 1
Error 1067 Invalid default value for 'b'
SET SESSION sql_mode = @old_mode;
DROP TABLE t1;
+set global default_storage_engine=default;
diff --git a/mysql-test/r/partition_key_cache.result b/mysql-test/r/partition_key_cache.result
index c5241c6ea90..7dd74837511 100644
--- a/mysql-test/r/partition_key_cache.result
+++ b/mysql-test/r/partition_key_cache.result
@@ -52,7 +52,7 @@ SELECT COUNT(b) FROM t1 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
-No!
+Yes!
INSERT t2 SELECT a,b,c FROM t1;
reads vs requests
reads == requests
@@ -63,7 +63,7 @@ SELECT COUNT(b) FROM t2 WHERE b >= 0;
COUNT(b)
2048
Zero key reads?
-No!
+Yes!
FLUSH TABLES;
# Setting the default key cache to 1M
SET GLOBAL key_buffer_size = 1024*1024;
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index aab6606104f..3f49bf9cc9e 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -1429,7 +1429,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00';
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 pNULL ref a a 4 const 1 Using where; Using index
+1 SIMPLE t1 pNULL ref a a 4 const 1 Using index
# Disabling warnings for the invalid date
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31';
id select_type table partitions type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 831dbeaf029..1529a0dfe95 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -75,9 +75,9 @@ SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
#illegal value fixed
CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS;
Warnings:
-Warning 1652 Incorrect value '10000000000000000000' for option 'ULL'
-Warning 1652 Incorrect value 'ttt' for option 'one_or_two'
-Warning 1652 Incorrect value 'SSS' for option 'YESNO'
+Warning 1708 Incorrect value '10000000000000000000' for option 'ULL'
+Warning 1708 Incorrect value 'ttt' for option 'one_or_two'
+Warning 1708 Incorrect value 'SSS' for option 'YESNO'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index ed68cd985c2..48a995f1b10 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3017,13 +3017,13 @@ PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1';
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1
EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1
DEALLOCATE PREPARE stmt;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 4cf1e58e1ea..df167cf3bdb 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1265,15 +1265,6 @@ drop procedure f3;
drop procedure f4;
drop table t1;
set GLOBAL query_cache_size=0;
-set GLOBAL query_cache_size=100000;
-set SESSION query_cache_size=10000;
-ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
-set global query_cache_limit=100;
-set global query_cache_size=100;
-set global query_cache_type=demand;
-set GLOBAL query_cache_type=default;
-set GLOBAL query_cache_limit=default;
-set GLOBAL query_cache_size=default;
End of 4.1 tests
SET GLOBAL query_cache_size=102400;
create table t1(a int);
diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result
index eb59e62c8ba..80c21add075 100644
--- a/mysql-test/r/query_cache_debug.result
+++ b/mysql-test/r/query_cache_debug.result
@@ -5,7 +5,7 @@ drop table if exists t1;
create table t1 (a varchar(100));
insert into t1 values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
Activate debug hook and attempt to retrieve the statement from the cache.
-set session debug='+d,wait_in_query_cache_insert';
+set session debug='+d,foobar,wait_in_query_cache_insert';
select SQL_CACHE * from t1;;
On a second connection; clear the query cache.
show status like 'Qcache_queries_in_cache';
@@ -32,7 +32,7 @@ SET GLOBAL concurrent_insert= 1;
SET GLOBAL query_cache_size= 1024*512;
SET GLOBAL query_cache_type= ON;
# Switch to connection con1
-SET SESSION debug='+d,wait_after_query_cache_invalidate';
+SET SESSION debug='+d,foobar,wait_after_query_cache_invalidate';
# Send concurrent insert, will wait in the query cache table invalidate
INSERT INTO t1 VALUES (4);
# Switch to connection default
@@ -108,8 +108,8 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
** before the mutex lock in invalidate_table_internal.
** This will allow new result sets to be written into the QC.
**
-SET SESSION debug='+d,wait_in_query_cache_invalidate1';
-SET SESSION debug='+d,wait_in_query_cache_invalidate2';
+SET SESSION debug='+d,foobar,wait_in_query_cache_invalidate1';
+SET SESSION debug='+d,foobar,wait_in_query_cache_invalidate2';
DELETE FROM t1 WHERE a like '%a%';;
=================================== Connection default
** Assert that the expect process status is obtained.
@@ -118,12 +118,12 @@ DELETE FROM t1 WHERE a like '%a%';;
** On THD2: Insert a result into the cache. This attempt will be blocked
** because of a debug hook placed just before the mutex lock after which
** the first part of the result set is written.
-SET SESSION debug='+d,wait_in_query_cache_insert';
+SET SESSION debug='+d,foobar,wait_in_query_cache_insert';
SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3;
=================================== Connection thd3
** On THD3: Insert another result into the cache and block on the same
** debug hook.
-SET SESSION debug='+d,wait_in_query_cache_insert';
+SET SESSION debug='+d,foobar,wait_in_query_cache_insert';
SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;;
=================================== Connection default
** Assert that the two SELECT-stmt threads to reach the hook.
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index a893cb03a42..b5716264f56 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4780,7 +4780,7 @@ b a
EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
-1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
Note 1003 select '2' AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index fb09a62eb73..1ae56bc33fe 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -2090,10 +2090,10 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
-t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
-t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
+t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
+t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
@@ -2430,27 +2430,28 @@ city
London
DROP TABLE t1;
create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
+insert into t1 values (1,0), (1,1), (18446744073709551615,0);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 3
select a-b from t1 order by 1;
a-b
0
1
-18446744073709551615
+4294967295
select a-b , (a-b < 0) from t1 order by 1;
a-b (a-b < 0)
0 0
1 0
-18446744073709551615 0
+4294967295 0
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
d (a-b >= 0) b
1 1 0
0 1 1
-18446744073709551615 1 2
select cast((a - b) as unsigned) from t1 order by 1;
cast((a - b) as unsigned)
0
1
-18446744073709551615
+4294967295
drop table t1;
create table t1 (a int(11));
select all all * from t1;
@@ -2788,26 +2789,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(key1) from t1 where key1 <= 0.6158;
max(key1)
-0.615800023078918
+0.6158000230789185
select max(key2) from t2 where key2 <= 1.6158;
max(key2)
-1.61580002307892
+1.6158000230789185
select min(key1) from t1 where key1 >= 0.3762;
min(key1)
-0.376199990510941
+0.37619999051094055
select min(key2) from t2 where key2 >= 1.3762;
min(key2)
-1.37619996070862
+1.3761999607086182
select max(key1), min(key2) from t1, t2
where key1 <= 0.6158 and key2 >= 1.3762;
max(key1) min(key2)
-0.615800023078918 1.37619996070862
+0.6158000230789185 1.3761999607086182
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
max(key1)
-0.615800023078918
+0.6158000230789185
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
min(key1)
-0.376199990510941
+0.37619999051094055
DROP TABLE t1,t2;
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
@@ -3423,6 +3424,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using MRR
DROP TABLE t1,t2;
+SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
INSERT t1 SET i = 0;
UPDATE t1 SET i = -1;
@@ -3442,8 +3444,9 @@ Warnings:
Warning 1264 Out of range value for column 'i' at row 1
SELECT * FROM t1;
i
-255
+0
DROP TABLE t1;
+SET SQL_MODE=default;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, c int, e int, primary key(a,b,c));
@@ -4171,9 +4174,10 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
set SQL_MODE=TRADITIONAL;
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
-0
+NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34'
+Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
0
@@ -4181,17 +4185,16 @@ Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
-0
+NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34:00'
+Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20'
-0
+NULL
Warnings:
-Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1
-Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1
+Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date
set SQL_MODE=DEFAULT;
select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
@@ -4338,6 +4341,7 @@ SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 10
Handler_read_prev 0
Handler_read_rnd 10
@@ -4426,7 +4430,7 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (2),(3);
# Should not crash
SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
+ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
@@ -4457,7 +4461,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
@@ -4468,7 +4472,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01' AS `a` from `test`.`t1` where 1
+Note 1003 select '2001-01-01' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
@@ -4479,7 +4483,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
@@ -4490,7 +4494,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
@@ -4500,7 +4504,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from `test`.`t1` where 0
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 0
SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
a b
2001-01-01 00:00:00 2001-01-01
@@ -4508,7 +4512,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
@@ -4527,7 +4531,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE y system NULL NULL NULL NULL 1 100.00
1 SIMPLE z system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from `test`.`t1` `x` join `test`.`t1` `y` join `test`.`t1` `z` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
#
# Bug #49897: crash in ptr_compare when char(0) NOT NULL
@@ -4641,7 +4645,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '1' AS `a`,'1' AS `b` from `test`.`t1` where 1
+Note 1003 select '1' AS `a`,'1' AS `b` from dual where 1
SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
a b
1 1
@@ -4742,6 +4746,72 @@ field2
15:13:38
drop table A,AA,B,BB;
#end of test for bug#45266
+#
+# Bug#33546: Slowdown on re-evaluation of constant expressions.
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t1 WHERE a = 1 + 1;
+a
+2
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
+SELECT * FROM t1 HAVING a = 1 + 1;
+a
+2
+EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
+SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
+a b
+4 2
+EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,'2' AS `b` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(('2' + (1 + 1))))
+SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
+b a
+2 3
+EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select '2' AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
+BEGIN
+SET @cnt := @cnt + 1;
+RETURN 1;
+END;|
+SET @cnt := 0;
+SELECT * FROM t1 WHERE a = f1();
+a
+1
+SELECT @cnt;
+@cnt
+1
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(`f1`()))
+DROP TABLE t1, t2;
+DROP FUNCTION f1;
+# End of bug#33546
#
# BUG#48052: Valgrind warning - uninitialized value in init_read_record()
#
@@ -4801,6 +4871,25 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
+# SELECT from VIEW with GROUP BY
+#
+CREATE TABLE t1 (
+col_int_key int DEFAULT NULL,
+KEY int_key (col_int_key)
+) ;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW view_t1 AS
+SELECT t1.col_int_key AS col_int_key
+FROM t1;
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+col_int_key
+1
+2
+DROP VIEW view_t1;
+DROP TABLE t1;
+# End of test BUG#54515
set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 7722fbe5dcc..b5716264f56 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -2086,10 +2086,10 @@ fld6 char(4) latin1_swedish_ci NO #
show full columns from t2 from test like 's%';
Field Type Collation Null Key Default Extra Privileges Comment
show keys from t2;
-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
-t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
-t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
+t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
+t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
@@ -2426,27 +2426,28 @@ city
London
DROP TABLE t1;
create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
+insert into t1 values (1,0), (1,1), (18446744073709551615,0);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 3
select a-b from t1 order by 1;
a-b
0
1
-18446744073709551615
+4294967295
select a-b , (a-b < 0) from t1 order by 1;
a-b (a-b < 0)
0 0
1 0
-18446744073709551615 0
+4294967295 0
select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
d (a-b >= 0) b
1 1 0
0 1 1
-18446744073709551615 1 2
select cast((a - b) as unsigned) from t1 order by 1;
cast((a - b) as unsigned)
0
1
-18446744073709551615
+4294967295
drop table t1;
create table t1 (a int(11));
select all all * from t1;
@@ -2784,26 +2785,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(key1) from t1 where key1 <= 0.6158;
max(key1)
-0.615800023078918
+0.6158000230789185
select max(key2) from t2 where key2 <= 1.6158;
max(key2)
-1.61580002307892
+1.6158000230789185
select min(key1) from t1 where key1 >= 0.3762;
min(key1)
-0.376199990510941
+0.37619999051094055
select min(key2) from t2 where key2 >= 1.3762;
min(key2)
-1.37619996070862
+1.3761999607086182
select max(key1), min(key2) from t1, t2
where key1 <= 0.6158 and key2 >= 1.3762;
max(key1) min(key2)
-0.615800023078918 1.37619996070862
+0.6158000230789185 1.3761999607086182
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
max(key1)
-0.615800023078918
+0.6158000230789185
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
min(key1)
-0.376199990510941
+0.37619999051094055
DROP TABLE t1,t2;
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
@@ -3419,6 +3420,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using MRR
DROP TABLE t1,t2;
+SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
INSERT t1 SET i = 0;
UPDATE t1 SET i = -1;
@@ -3438,8 +3440,9 @@ Warnings:
Warning 1264 Out of range value for column 'i' at row 1
SELECT * FROM t1;
i
-255
+0
DROP TABLE t1;
+SET SQL_MODE=default;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, c int, e int, primary key(a,b,c));
@@ -4167,9 +4170,10 @@ str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
set SQL_MODE=TRADITIONAL;
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
-0
+NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34'
+Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34'
0
@@ -4177,17 +4181,16 @@ Warnings:
Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34'
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34'
-0
+NULL
Warnings:
-Warning 1292 Truncated incorrect datetime value: '2007-10-00 12:34:00'
+Warning 1411 Incorrect datetime value: '2007-10-00 12:34' for function str_to_date
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
and '2007/10/20'
-0
+NULL
Warnings:
-Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/09/01' at row 1
-Warning 1292 Incorrect datetime value: '2007-10-00' for column '2007/10/20' at row 1
+Warning 1411 Incorrect datetime value: '2007-10-00' for function str_to_date
set SQL_MODE=DEFAULT;
select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'
@@ -4334,6 +4337,7 @@ SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -4422,7 +4426,7 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (2),(3);
# Should not crash
SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
+ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
@@ -4453,7 +4457,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
@@ -4464,7 +4468,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01' AS `a` from `test`.`t1` where 1
+Note 1003 select '2001-01-01' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a TIMESTAMP NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
@@ -4475,7 +4479,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
@@ -4486,7 +4490,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
@@ -4496,7 +4500,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from `test`.`t1` where 0
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 0
SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
a b
2001-01-01 00:00:00 2001-01-01
@@ -4504,7 +4508,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from `test`.`t1` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1
DROP TABLE t1;
CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
@@ -4523,7 +4527,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE y system NULL NULL NULL NULL 1 100.00
1 SIMPLE z system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from `test`.`t1` `x` join `test`.`t1` `y` join `test`.`t1` `z` where 1
+Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from dual where 1
DROP TABLE t1;
#
# Bug #49897: crash in ptr_compare when char(0) NOT NULL
@@ -4637,7 +4641,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 select '1' AS `a`,'1' AS `b` from `test`.`t1` where 1
+Note 1003 select '1' AS `a`,'1' AS `b` from dual where 1
SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
a b
1 1
@@ -4738,6 +4742,72 @@ field2
15:13:38
drop table A,AA,B,BB;
#end of test for bug#45266
+#
+# Bug#33546: Slowdown on re-evaluation of constant expressions.
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t1 WHERE a = 1 + 1;
+a
+2
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
+SELECT * FROM t1 HAVING a = 1 + 1;
+a
+2
+EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
+SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
+a b
+4 2
+EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,'2' AS `b` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(('2' + (1 + 1))))
+SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
+b a
+2 3
+EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select '2' AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
+BEGIN
+SET @cnt := @cnt + 1;
+RETURN 1;
+END;|
+SET @cnt := 0;
+SELECT * FROM t1 WHERE a = f1();
+a
+1
+SELECT @cnt;
+@cnt
+1
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>(`f1`()))
+DROP TABLE t1, t2;
+DROP FUNCTION f1;
+# End of bug#33546
#
# BUG#48052: Valgrind warning - uninitialized value in init_read_record()
#
@@ -4797,3 +4867,22 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
DROP TABLE t1;
End of 5.1 tests
+#
+# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
+# SELECT from VIEW with GROUP BY
+#
+CREATE TABLE t1 (
+col_int_key int DEFAULT NULL,
+KEY int_key (col_int_key)
+) ;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW view_t1 AS
+SELECT t1.col_int_key AS col_int_key
+FROM t1;
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+col_int_key
+1
+2
+DROP VIEW view_t1;
+DROP TABLE t1;
+# End of test BUG#54515
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 135109cac88..073b0b331f0 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -254,11 +254,13 @@ drop table t1;
flush tables;
show open tables;
Database Table In_use Name_locked
+mysql general_log 0 0
create table t1(n int);
insert into t1 values (1);
show open tables;
Database Table In_use Name_locked
test t1 0 0
+mysql general_log 0 0
drop table t1;
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
show create table t1;
diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result
index 72419c6ec9d..00231d8377a 100644
--- a/mysql-test/r/single_delete_update.result
+++ b/mysql-test/r/single_delete_update.result
@@ -306,21 +306,21 @@ NULL 13 13
SHOW SESSION STATUS LIKE 'Sort%';
Variable_name Value
Sort_merge_passes 0
-Sort_range 1
+Sort_range 0
Sort_rows 4
-Sort_scan 0
+Sort_scan 1
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 2
+Handler_read_key 0
Handler_read_last 0
-Handler_read_next 7
+Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 4
-Handler_read_rnd_next 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+x x x x x x x x x x Using where; Using filesort
Warnings:
x x x
FLUSH STATUS;
@@ -328,18 +328,18 @@ DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
SHOW SESSION STATUS LIKE 'Sort%';
Variable_name Value
Sort_merge_passes 0
-Sort_range 1
+Sort_range 0
Sort_rows 4
-Sort_scan 0
+Sort_scan 1
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 2
+Handler_read_key 0
Handler_read_last 0
-Handler_read_next 7
+Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 8
-Handler_read_rnd_next 0
+Handler_read_rnd 4
+Handler_read_rnd_next 17
SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
i key1 key2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
@@ -850,21 +850,21 @@ NULL 13 13
SHOW SESSION STATUS LIKE 'Sort%';
Variable_name Value
Sort_merge_passes 0
-Sort_range 1
+Sort_range 0
Sort_rows 4
-Sort_scan 0
+Sort_scan 1
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 2
+Handler_read_key 0
Handler_read_last 0
-Handler_read_next 7
+Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 4
-Handler_read_rnd_next 0
+Handler_read_rnd 0
+Handler_read_rnd_next 17
EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+x x x x x x x x x x Using where; Using filesort
Warnings:
x x x
FLUSH STATUS;
@@ -872,18 +872,18 @@ UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
SHOW SESSION STATUS LIKE 'Sort%';
Variable_name Value
Sort_merge_passes 0
-Sort_range 1
+Sort_range 0
Sort_rows 4
-Sort_scan 0
+Sort_scan 1
SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 2
+Handler_read_key 0
Handler_read_last 0
-Handler_read_next 7
+Handler_read_next 0
Handler_read_prev 0
-Handler_read_rnd 8
-Handler_read_rnd_next 0
+Handler_read_rnd 4
+Handler_read_rnd_next 17
SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
i key1 key2
123 10 10
@@ -892,7 +892,7 @@ i key1 key2
123 13 13
EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
id select_type table type possible_keys key key_len ref rows filtered Extra
-x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort
+x x x x x x x x x x Using where; Using filesort
Warnings:
x x x
DROP TABLE t2;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 5a1a35b2571..0f18e0e5d6f 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -6528,16 +6528,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c1 c1 5 const 1 Using index
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM v1 WHERE c1=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using index
EXPLAIN SELECT * FROM v1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c1 c1 5 const 1 Using index
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c1 c1 5 const 1 Using index
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
diff --git a/mysql-test/r/status_user.result b/mysql-test/r/status_user.result
index 636eeabfffc..ace8d9f26bf 100644
--- a/mysql-test/r/status_user.result
+++ b/mysql-test/r/status_user.result
@@ -102,6 +102,7 @@ Handler_discover 0
Handler_prepare 18
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 5b2176ac872..f4e07636467 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -734,7 +734,7 @@ id
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
@@ -3561,6 +3561,30 @@ ORDER BY t1.t DESC LIMIT 1);
i1 i2 t i1 i2 t
24 1 2005-05-27 12:40:30 24 1 2006-06-20 12:29:40
DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+(SELECT i FROM t1) UNION (SELECT i FROM t1);
+i
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+(
+(SELECT i FROM t1) UNION
+(SELECT i FROM t1)
+);
+i
+SELECT * FROM t1
+WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION (SELECT i FROM t1)))' at line 2
+explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union (select t12.i from t1 t12))
+from t1' at line 1
+explain select * from t1 where not exists
+((select t11.i from t1 t11) union (select t12.i from t1 t12));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
insert into t1 (a) values (FLOOR(rand() * 100));
insert into t1 (a) select FLOOR(rand() * 100) from t1;
@@ -4248,6 +4272,35 @@ out_a MIN(b)
1 2
2 4
DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+2
+2
+2
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+(SELECT 1 FROM t2 WHERE t1.a = t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(f11 int, f12 int);
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 1fc9309da4f..15546f6c75c 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -882,7 +882,7 @@ Level Code Message
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
Error 1054 Unknown column 'c' in 'field list'
-Note 1003 select `c` AS `c` from (select <expr_cache><count(`test`.`t1`.`a`),`test`.`t1`.`c`>((select count(`test`.`t1`.`a`) from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `t1`.`c`)) AS `(SELECT COUNT(a) FROM
+Note 1003 select `c` AS `c` from (select <expr_cache><count(`test`.`t1`.`a`),`test`.`t1`.`c`>((select count(`test`.`t1`.`a`) from dual group by `t1`.`c`)) AS `(SELECT COUNT(a) FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
DROP TABLE t1;
@@ -1280,6 +1280,8 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
set @save_optimizer_search_depth=@@optimizer_search_depth;
set @@optimizer_search_depth=63;
+Warnings:
+Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
explain select * from t1 where (a,b) in (select a,b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
@@ -1427,6 +1429,7 @@ CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause'
DROP PROCEDURE p1;
DROP TABLE t1, t2;
+End of 5.3 tests
#
# BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery
# in the select list
@@ -1474,6 +1477,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,(select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2`
+Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`))) AS `subsel` from `test`.`t2`
DROP TABLE t1,t2;
End of 5.6 tests
diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result
index d24c1baa814..0019a82f2dd 100644
--- a/mysql-test/r/subselect3_jcl6.result
+++ b/mysql-test/r/subselect3_jcl6.result
@@ -121,6 +121,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -885,7 +886,7 @@ Level Code Message
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
Error 1054 Unknown column 'c' in 'field list'
-Note 1003 select `c` AS `c` from (select <expr_cache><count(`test`.`t1`.`a`),`test`.`t1`.`c`>((select count(`test`.`t1`.`a`) from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `t1`.`c`)) AS `(SELECT COUNT(a) FROM
+Note 1003 select `c` AS `c` from (select <expr_cache><count(`test`.`t1`.`a`),`test`.`t1`.`c`>((select count(`test`.`t1`.`a`) from dual group by `t1`.`c`)) AS `(SELECT COUNT(a) FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
DROP TABLE t1;
@@ -1284,6 +1285,8 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 100
set @save_optimizer_search_depth=@@optimizer_search_depth;
set @@optimizer_search_depth=63;
+Warnings:
+Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
explain select * from t1 where (a,b) in (select a,b from t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 10
@@ -1431,6 +1434,57 @@ CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause'
DROP PROCEDURE p1;
DROP TABLE t1, t2;
+End of 5.3 tests
+#
+# BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery
+# in the select list
+#
+
+CREATE TABLE t1 (
+i int(11) DEFAULT NULL,
+v varchar(1) DEFAULT NULL
+);
+
+INSERT INTO t1 VALUES (8,'v');
+INSERT INTO t1 VALUES (9,'r');
+INSERT INTO t1 VALUES (NULL,'y');
+
+CREATE TABLE t2 (
+i int(11) DEFAULT NULL,
+v varchar(1) DEFAULT NULL,
+KEY i_key (i)
+);
+
+INSERT INTO t2 VALUES (NULL,'r');
+INSERT INTO t2 VALUES (0,'c');
+INSERT INTO t2 VALUES (0,'o');
+INSERT INTO t2 VALUES (2,'v');
+INSERT INTO t2 VALUES (7,'c');
+
+SELECT i, v, (SELECT COUNT(DISTINCT i)
+FROM t1
+WHERE v = t2.v) as subsel
+FROM t2;
+i v subsel
+NULL r 1
+0 c 0
+0 o 0
+2 v 1
+7 c 0
+
+EXPLAIN EXTENDED
+SELECT i, v, (SELECT COUNT(DISTINCT i)
+FROM t1
+WHERE v = t2.v) as subsel
+FROM t2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((select count(distinct `test`.`t1`.`i`) from `test`.`t1` where (`test`.`t1`.`v` = `test`.`t2`.`v`))) AS `subsel` from `test`.`t2`
+DROP TABLE t1,t2;
+End of 5.6 tests
set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index ea836bea76a..72fa5f23ab1 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -117,14 +117,14 @@ EXPLAIN
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
-x DEPENDENT SUBQUERY x x x x x x x x
+x SUBQUERY x x x x x x x x
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
a b
EXPLAIN
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
-2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
a b
1 NULL
@@ -147,28 +147,28 @@ EXPLAIN
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
-x DEPENDENT SUBQUERY x x x x x x x x
+x SUBQUERY x x x x x x x x
SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
a b
EXPLAIN
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
-x DEPENDENT SUBQUERY x x x x x x x x
+x SUBQUERY x x x x x x x x
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
c d
EXPLAIN
SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
-x DEPENDENT SUBQUERY x x x x x x x x
+x SUBQUERY x x x x x x x x
SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
e f
EXPLAIN
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
id select_type table type possible_keys key key_len ref rows Extra
x PRIMARY x x x x x x x x
-x DEPENDENT SUBQUERY x x x x x x x x
+x SUBQUERY x x x x x x x x
SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
c d
SELECT * FROM t1 WHERE ( a, b ) NOT IN
@@ -209,7 +209,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where 0)) AS `RESULT` from `test`.`t1`
+Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual
first equivalent variant
SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c ;
RESULT
@@ -220,7 +220,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where 0)) AS `RESULT` from `test`.`t1` group by NULL
+Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual group by NULL
second equivalent variant
SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
RESULT
@@ -231,7 +231,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
-Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where 0)) AS `RESULT` from `test`.`t1` group by NULL
+Note 1003 select <expr_cache><NULL>((select 1 from `test`.`t2` where 0)) AS `RESULT` from dual group by NULL
DROP TABLE t1,t2;
#
# BUG#45928 "Differing query results depending on MRR and
@@ -252,6 +252,8 @@ set @old_optimizer_switch = @@session.optimizer_switch,
SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off';
SET SESSION optimizer_use_mrr = 'force';
SET SESSION engine_condition_pushdown = 1;
+Warnings:
+Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
SELECT `time_nokey` G1 FROM t1 WHERE ( `varchar_nokey` , `varchar_key` ) IN (
SELECT `varchar_nokey` , `varchar_nokey` ) AND `varchar_key` >= 'c' HAVING G1 ORDER
BY `pk` ;
@@ -259,6 +261,8 @@ G1
set @@session.optimizer_switch = @old_optimizer_switch,
@@session.optimizer_use_mrr = @old_optimizer_use_mrr,
@@session.engine_condition_pushdown = @old_engine_condition_pushdown;
+Warnings:
+Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
DROP TABLE t1;
#
# BUG#45863 "Assertion failed: (fixed == 0), function fix_fields(),
@@ -469,6 +473,8 @@ SELECT @old_icp:=@@engine_condition_pushdown;
@old_icp:=@@engine_condition_pushdown
#
SET SESSION engine_condition_pushdown = 'ON';
+Warnings:
+Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
SELECT pk
FROM t2
@@ -482,8 +488,13 @@ pk
9
# Restore old value for Index condition pushdown
SET SESSION engine_condition_pushdown=@old_icp;
+Warnings:
+Warning 1287 The syntax '@@engine_condition_pushdown' is deprecated and will be removed in MySQL 7.0. Please use '@@optimizer_switch' instead
DROP TABLE t1,t2;
#
+# End of 5.3 tests.
+#
+#
# Bug#53236 Segfault in DTCollation::set(DTCollation&)
#
CREATE TABLE t1 (
diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result
index 7b9dc3c943f..2c7715f93ae 100644
--- a/mysql-test/r/subselect_cache.result
+++ b/mysql-test/r/subselect_cache.result
@@ -28,6 +28,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 7
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -54,6 +55,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -79,6 +81,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 7
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -103,6 +106,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -128,6 +132,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 7
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -152,6 +157,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -249,6 +255,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 7
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -345,6 +352,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -366,6 +374,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 17
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 4
@@ -386,6 +395,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 10
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 4
@@ -407,6 +417,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 17
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 4
@@ -427,6 +438,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 10
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 4
@@ -454,6 +466,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 7
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -480,6 +493,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -501,6 +515,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 7
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 4
@@ -521,6 +536,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 4
@@ -618,6 +634,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 70
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -714,6 +731,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1337,6 +1355,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 11
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1365,6 +1384,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 32
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1396,6 +1416,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1424,6 +1445,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 13
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1613,6 +1635,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 15
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 8
@@ -1637,6 +1660,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 21
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 8
@@ -1662,6 +1686,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 15
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 8
@@ -1686,6 +1711,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 22
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 8
@@ -1726,6 +1752,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 15
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1762,6 +1789,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1797,6 +1825,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 15
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -1832,6 +1861,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 18
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -2521,6 +2551,71 @@ WHERE table1 .`col_varchar_key` ) field10
1 NULL u
1 NULL w
1 NULL y
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
SET @@optimizer_switch='subquery_cache=on';
/* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
SELECT SUBQUERY2_t1 .`col_int_key`
@@ -2547,6 +2642,71 @@ WHERE table1 .`col_varchar_key` ) field10
1 NULL u
1 NULL w
1 NULL y
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'o'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
drop table t1,t2,t3,t4;
set @@optimizer_switch= default;
#launchpad BUG#609045
@@ -2970,6 +3130,8 @@ FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
WHERE table1 .`col_varchar_key` ) field10
1 NULL d
1 NULL f
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'f'
SET @@optimizer_switch = 'subquery_cache=on';
/* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
SELECT SUBQUERY2_t1 .`col_int_key`
@@ -2983,6 +3145,8 @@ FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
WHERE table1 .`col_varchar_key` ) field10
1 NULL d
1 NULL f
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'f'
drop table t1,t2,t3,t4;
set @@optimizer_switch= default;
#launchpad BUG#611625
@@ -3270,6 +3434,71 @@ WHERE table3 .`col_varchar_key` IN (
SELECT `col_varchar_key`
FROM t2 ) AND table1 .`col_varchar_key` OR table1 .`pk` ;
col_varchar_nokey
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'w'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 't'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'u'
+Warning 1292 Truncated incorrect DOUBLE value: 'h'
+Warning 1292 Truncated incorrect DOUBLE value: 'o'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'e'
+Warning 1292 Truncated incorrect DOUBLE value: 'n'
+Warning 1292 Truncated incorrect DOUBLE value: 't'
+Warning 1292 Truncated incorrect DOUBLE value: 'c'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'y'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'v'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'y'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'z'
+Warning 1292 Truncated incorrect DOUBLE value: 'e'
+Warning 1292 Truncated incorrect DOUBLE value: 'h'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 's'
+Warning 1292 Truncated incorrect DOUBLE value: 'e'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'e'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'v'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'c'
+Warning 1292 Truncated incorrect DOUBLE value: 'w'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 't'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'u'
+Warning 1292 Truncated incorrect DOUBLE value: 'h'
+Warning 1292 Truncated incorrect DOUBLE value: 'o'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'e'
+Warning 1292 Truncated incorrect DOUBLE value: 'n'
+Warning 1292 Truncated incorrect DOUBLE value: 't'
+Warning 1292 Truncated incorrect DOUBLE value: 'c'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'y'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'w'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'm'
+Warning 1292 Truncated incorrect DOUBLE value: 'k'
+Warning 1292 Truncated incorrect DOUBLE value: 'r'
+Warning 1292 Truncated incorrect DOUBLE value: 't'
drop table t1,t2;
set @@optimizer_switch= default;
# LP BUG#615378 (incorrect NULL result returning in Item_cache)
@@ -3309,4 +3538,7 @@ WHERE ( table1 . `pk` < 5 ) OR ( table1 . `col_varchar_key` IS NOT NULL)
GROUP BY field3
HAVING (field3 <= 'h' AND field2 != 4) ;
field2 field3
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'v'
+Warning 1292 Truncated incorrect INTEGER value: 'r'
drop tables t1, t2, t3;
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 78e6467ae62..bcde5a24fb9 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -57,7 +57,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><'1'>((select '1')) = 1)
+Note 1003 select 1 AS `1` from dual having (<expr_cache><'1'>((select '1')) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -210,7 +210,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from dual
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a
2
@@ -321,7 +321,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select '2' from dual where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -738,11 +738,11 @@ id
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -929,7 +929,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -939,7 +939,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
@@ -1440,7 +1440,7 @@ explain extended (select * from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 (select 'tttt' AS `s1` from `test`.`t1`)
+Note 1003 (select 'tttt' AS `s1` from dual)
(select * from t1);
s1
tttt
@@ -1628,7 +1628,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from `test`.`t1` where 1
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3565,6 +3565,30 @@ ORDER BY t1.t DESC LIMIT 1);
i1 i2 t i1 i2 t
24 1 2005-05-27 12:40:30 24 1 2006-06-20 12:29:40
DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+(SELECT i FROM t1) UNION (SELECT i FROM t1);
+i
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+(
+(SELECT i FROM t1) UNION
+(SELECT i FROM t1)
+);
+i
+SELECT * FROM t1
+WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION (SELECT i FROM t1)))' at line 2
+explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union (select t12.i from t1 t12))
+from t1' at line 1
+explain select * from t1 where not exists
+((select t11.i from t1 t11) union (select t12.i from t1 t12));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
insert into t1 (a) values (FLOOR(rand() * 100));
insert into t1 (a) select FLOOR(rand() * 100) from t1;
@@ -3661,8 +3685,6 @@ insert into t1 select RAND()*1000, A.a + 10*(B.a+10*(C.a+10*D.a))
from t3 A, t3 B, t3 C, t3 D where D.a<3;
insert into t2(y,z) select t1.b, RAND()*1000 from t1, t3;
SET SESSION sort_buffer_size = 32 * 1024;
-Warnings:
-Warning 1292 Truncated incorrect sort_buffer_size value: '32768'
SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
@@ -4254,6 +4276,35 @@ out_a MIN(b)
1 2
2 4
DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+2
+2
+2
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+(SELECT 1 FROM t2 WHERE t1.a = t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(f11 int, f12 int);
@@ -4795,6 +4846,270 @@ id g v s
51 50 NULL l
61 60 NULL l
drop table t1, t2;
+#
+# Bug#33204: INTO is allowed in subselect, causing inconsistent results
+#
+CREATE TABLE t1( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2( a INT, b INT );
+SELECT *
+FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO @var FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
+a
+2
+SELECT * FROM (
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+1
+2
+SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
+a
+1
+SELECT * FROM (SELECT 1 UNION SELECT 1) t1a;
+1
+1
+SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a LIMIT 1) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
+a
+1
+SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
+a 1
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM (t1 t1a);
+a
+1
+2
+SELECT * FROM ((t1 t1a));
+a
+1
+2
+SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 t1a)) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN (SELECT 1 a) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 a)) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM (t1 JOIN (SELECT 1) t1a1 ON 1) t1a2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a2' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 3 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 ) a
+1 1
+1 2
+SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ) a
+1 1
+1 2
+SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
+a b
+SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+( SELECT 1 UNION SELECT 1 UNION SELECT 1 )
+1
+SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
+((SELECT 1 UNION SELECT 1 UNION SELECT 1))
+1
+SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') UNION SELECT 1 )' at line 1
+SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
+1
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT EXISTS(SELECT 1+1);
+EXISTS(SELECT 1+1)
+1
+SELECT EXISTS(SELECT 1+1 INTO @test);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @test)' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+DROP TABLE t1, t2;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index d4b0e33f653..a8b4065d257 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -54,7 +54,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><'1'>((select '1')) = 1)
+Note 1003 select 1 AS `1` from dual having (<expr_cache><'1'>((select '1')) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from dual
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a
2
@@ -318,7 +318,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select '2' from dual where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -735,11 +735,11 @@ id
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -926,7 +926,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -936,7 +936,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
@@ -1437,7 +1437,7 @@ explain extended (select * from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 (select 'tttt' AS `s1` from `test`.`t1`)
+Note 1003 (select 'tttt' AS `s1` from dual)
(select * from t1);
s1
tttt
@@ -1625,7 +1625,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from `test`.`t1` where 1
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3562,6 +3562,30 @@ ORDER BY t1.t DESC LIMIT 1);
i1 i2 t i1 i2 t
24 1 2005-05-27 12:40:30 24 1 2006-06-20 12:29:40
DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+(SELECT i FROM t1) UNION (SELECT i FROM t1);
+i
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+(
+(SELECT i FROM t1) UNION
+(SELECT i FROM t1)
+);
+i
+SELECT * FROM t1
+WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION (SELECT i FROM t1)))' at line 2
+explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union (select t12.i from t1 t12))
+from t1' at line 1
+explain select * from t1 where not exists
+((select t11.i from t1 t11) union (select t12.i from t1 t12));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
insert into t1 (a) values (FLOOR(rand() * 100));
insert into t1 (a) select FLOOR(rand() * 100) from t1;
@@ -3658,8 +3682,6 @@ insert into t1 select RAND()*1000, A.a + 10*(B.a+10*(C.a+10*D.a))
from t3 A, t3 B, t3 C, t3 D where D.a<3;
insert into t2(y,z) select t1.b, RAND()*1000 from t1, t3;
SET SESSION sort_buffer_size = 32 * 1024;
-Warnings:
-Warning 1292 Truncated incorrect sort_buffer_size value: '32768'
SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
@@ -4251,6 +4273,35 @@ out_a MIN(b)
1 2
2 4
DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+2
+2
+2
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+(SELECT 1 FROM t2 WHERE t1.a = t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(f11 int, f12 int);
@@ -4792,6 +4843,270 @@ id g v s
51 50 NULL l
61 60 NULL l
drop table t1, t2;
+#
+# Bug#33204: INTO is allowed in subselect, causing inconsistent results
+#
+CREATE TABLE t1( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2( a INT, b INT );
+SELECT *
+FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO @var FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
+a
+2
+SELECT * FROM (
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+1
+2
+SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
+a
+1
+SELECT * FROM (SELECT 1 UNION SELECT 1) t1a;
+1
+1
+SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a LIMIT 1) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
+a
+1
+SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
+a 1
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM (t1 t1a);
+a
+1
+2
+SELECT * FROM ((t1 t1a));
+a
+1
+2
+SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 t1a)) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN (SELECT 1 a) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 a)) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM (t1 JOIN (SELECT 1) t1a1 ON 1) t1a2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a2' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 3 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 ) a
+1 1
+1 2
+SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ) a
+1 1
+1 2
+SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
+a b
+SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+( SELECT 1 UNION SELECT 1 UNION SELECT 1 )
+1
+SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
+((SELECT 1 UNION SELECT 1 UNION SELECT 1))
+1
+SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') UNION SELECT 1 )' at line 1
+SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
+1
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT EXISTS(SELECT 1+1);
+EXISTS(SELECT 1+1)
+1
+SELECT EXISTS(SELECT 1+1 INTO @test);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @test)' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+DROP TABLE t1, t2;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index f9ec2abade1..511fa140ca8 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -54,7 +54,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><'1'>((select '1')) = 1)
+Note 1003 select 1 AS `1` from dual having (<expr_cache><'1'>((select '1')) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
@@ -207,7 +207,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
Warnings:
-Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from dual
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
a
2
@@ -318,7 +318,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 select <expr_cache><`test`.`t2`.`a`>((select '2' from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select '2' from dual where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
ERROR 21000: Subquery returns more than 1 row
create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -735,11 +735,11 @@ id
2
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
Warnings:
Note 1249 Select 3 was reduced during optimization
Note 1249 Select 2 was reduced during optimization
-Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
@@ -926,7 +926,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
1 1 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
1 0 a
@@ -936,7 +936,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
1 0 a
2 0 b
-NULL 0 NULL
+NULL NULL NULL
drop table t1,t2;
create table t1 (a int, b real, c varchar(10));
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
@@ -1437,7 +1437,7 @@ explain extended (select * from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
-Note 1003 (select 'tttt' AS `s1` from `test`.`t1`)
+Note 1003 (select 'tttt' AS `s1` from dual)
(select * from t1);
s1
tttt
@@ -1625,7 +1625,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION t1 system NULL NULL NULL NULL 1 100.00
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 'e' AS `s1` from `test`.`t1` where 1
+Note 1003 select 'e' AS `s1` from dual where 1
drop table t1;
CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
@@ -3562,6 +3562,30 @@ ORDER BY t1.t DESC LIMIT 1);
i1 i2 t i1 i2 t
24 1 2005-05-27 12:40:30 24 1 2006-06-20 12:29:40
DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+(SELECT i FROM t1) UNION (SELECT i FROM t1);
+i
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+(
+(SELECT i FROM t1) UNION
+(SELECT i FROM t1)
+);
+i
+SELECT * FROM t1
+WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION (SELECT i FROM t1)))' at line 2
+explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union (select t12.i from t1 t12))
+from t1' at line 1
+explain select * from t1 where not exists
+((select t11.i from t1 t11) union (select t12.i from t1 t12));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
insert into t1 (a) values (FLOOR(rand() * 100));
insert into t1 (a) select FLOOR(rand() * 100) from t1;
@@ -3658,8 +3682,6 @@ insert into t1 select RAND()*1000, A.a + 10*(B.a+10*(C.a+10*D.a))
from t3 A, t3 B, t3 C, t3 D where D.a<3;
insert into t2(y,z) select t1.b, RAND()*1000 from t1, t3;
SET SESSION sort_buffer_size = 32 * 1024;
-Warnings:
-Warning 1292 Truncated incorrect sort_buffer_size value: '32768'
SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
@@ -4251,6 +4273,35 @@ out_a MIN(b)
1 2
2 4
DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+2
+2
+2
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+(SELECT 1 FROM t2 WHERE t1.a = t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(f11 int, f12 int);
@@ -4792,6 +4843,270 @@ id g v s
51 50 NULL l
61 60 NULL l
drop table t1, t2;
+#
+# Bug#33204: INTO is allowed in subselect, causing inconsistent results
+#
+CREATE TABLE t1( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2( a INT, b INT );
+SELECT *
+FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO @var FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
+a
+2
+SELECT * FROM (
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+1
+2
+SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
+a
+1
+SELECT * FROM (SELECT 1 UNION SELECT 1) t1a;
+1
+1
+SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a LIMIT 1) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
+a
+1
+SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
+a 1
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM (t1 t1a);
+a
+1
+2
+SELECT * FROM ((t1 t1a));
+a
+1
+2
+SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 t1a)) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN (SELECT 1 a) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 a)) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM (t1 JOIN (SELECT 1) t1a1 ON 1) t1a2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1a2' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 3 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 ) a
+1 1
+1 2
+SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ) a
+1 1
+1 2
+SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
+a b
+SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+( SELECT 1 UNION SELECT 1 UNION SELECT 1 )
+1
+SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
+((SELECT 1 UNION SELECT 1 UNION SELECT 1))
+1
+SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') UNION SELECT 1 )' at line 1
+SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
+1
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT EXISTS(SELECT 1+1);
+EXISTS(SELECT 1+1)
+1
+SELECT EXISTS(SELECT 1+1 INTO @test);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @test)' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
+DROP TABLE t1, t2;
CREATE TABLE t1 (a ENUM('rainbow'));
INSERT INTO t1 VALUES (),(),(),(),();
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index f17edf3be6c..00c62920fce 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -60,7 +60,7 @@ a b pk1 pk2 pk3
set @save_max_heap_table_size= @@max_heap_table_size;
set max_heap_table_size=16384;
set @save_join_buffer_size = @@join_buffer_size;
-set join_buffer_size= 8000;
+set join_buffer_size= 8192;
drop table t3;
create table t3 (
a int,
@@ -77,8 +77,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY subselect2 ALL unique_key NULL NULL NULL 10
1 PRIMARY t3 ref b b 5 test.t0.a 1
2 SUBQUERY t0 ALL NULL NULL NULL NULL 10
-set @save_ecp= @@engine_condition_pushdown;
-set engine_condition_pushdown=0;
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
a b pk1 pk2
0 0 0 0
@@ -95,7 +93,6 @@ a b pk1 pk2
11 11 11 11
12 12 12 12
13 13 13 13
-set engine_condition_pushdown=@save_ecp;
set join_buffer_size= @save_join_buffer_size;
set max_heap_table_size= @save_max_heap_table_size;
explain select * from t1 where a in (select b from t2);
@@ -115,7 +112,7 @@ a b
2 2
drop table t1, t2, t3;
set @save_join_buffer_size = @@join_buffer_size;
-set join_buffer_size= 8000;
+set join_buffer_size= 8192;
create table t1 (a int, filler1 binary(200), filler2 binary(200));
insert into t1 select a, 'filler123456', 'filler123456' from t0;
insert into t1 select a+10, 'filler123456', 'filler123456' from t0;
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result
index 67215d1715e..8e3ec975b35 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -64,7 +64,7 @@ a b pk1 pk2 pk3
set @save_max_heap_table_size= @@max_heap_table_size;
set max_heap_table_size=16384;
set @save_join_buffer_size = @@join_buffer_size;
-set join_buffer_size= 8000;
+set join_buffer_size= 8192;
drop table t3;
create table t3 (
a int,
@@ -79,10 +79,8 @@ from t0 A, t0 B where B.a <5;
explain select * from t3 where b in (select a from t0);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY subselect2 ALL unique_key NULL NULL NULL 10
-1 PRIMARY t3 ref b b 5 test.t0.a 1 Using join buffer
+1 PRIMARY t3 ref b b 5 test.t0.a 1
2 SUBQUERY t0 ALL NULL NULL NULL NULL 10
-set @save_ecp= @@engine_condition_pushdown;
-set engine_condition_pushdown=0;
select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
a b pk1 pk2
0 0 0 0
@@ -99,7 +97,6 @@ a b pk1 pk2
11 11 11 11
12 12 12 12
13 13 13 13
-set engine_condition_pushdown=@save_ecp;
set join_buffer_size= @save_join_buffer_size;
set max_heap_table_size= @save_max_heap_table_size;
explain select * from t1 where a in (select b from t2);
@@ -119,7 +116,7 @@ a b
2 2
drop table t1, t2, t3;
set @save_join_buffer_size = @@join_buffer_size;
-set join_buffer_size= 8000;
+set join_buffer_size= 8192;
create table t1 (a int, filler1 binary(200), filler2 binary(200));
insert into t1 select a, 'filler123456', 'filler123456' from t0;
insert into t1 select a+10, 'filler123456', 'filler123456' from t0;
diff --git a/mysql-test/r/table_options.result b/mysql-test/r/table_options.result
index ed6fe4fb3de..d0ebbeb0197 100644
--- a/mysql-test/r/table_options.result
+++ b/mysql-test/r/table_options.result
@@ -3,9 +3,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1';
Warnings:
-Warning 1651 Unknown option 'fkey'
-Warning 1651 Unknown option 'dff'
-Warning 1651 Unknown option 'tkey1'
+Warning 1707 Unknown option 'fkey'
+Warning 1707 Unknown option 'dff'
+Warning 1707 Unknown option 'tkey1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -16,10 +16,10 @@ drop table t1;
#reassiginig options in the same line
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1;
Warnings:
-Warning 1651 Unknown option 'fkey'
-Warning 1651 Unknown option 'dff'
-Warning 1651 Unknown option 'tkey1'
-Warning 1651 Unknown option 'tkey2'
+Warning 1707 Unknown option 'fkey'
+Warning 1707 Unknown option 'dff'
+Warning 1707 Unknown option 'tkey1'
+Warning 1707 Unknown option 'tkey2'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -29,7 +29,7 @@ t1 CREATE TABLE `t1` (
#add option
alter table t1 tkey4=4v1;
Warnings:
-Warning 1651 Unknown option 'tkey4'
+Warning 1707 Unknown option 'tkey4'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -39,8 +39,8 @@ t1 CREATE TABLE `t1` (
#remove options
alter table t1 tkey3=DEFAULT tkey4=DEFAULT;
Warnings:
-Warning 1651 Unknown option 'tkey3'
-Warning 1651 Unknown option 'tkey4'
+Warning 1707 Unknown option 'tkey3'
+Warning 1707 Unknown option 'tkey4'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -50,11 +50,11 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1;
Warnings:
-Warning 1651 Unknown option 'fkey1'
-Warning 1651 Unknown option 'kkey1'
-Warning 1651 Unknown option 'TKEY1'
-Warning 1651 Unknown option 'tkey2'
-Warning 1651 Unknown option 'tkey3'
+Warning 1707 Unknown option 'fkey1'
+Warning 1707 Unknown option 'kkey1'
+Warning 1707 Unknown option 'TKEY1'
+Warning 1707 Unknown option 'tkey2'
+Warning 1707 Unknown option 'tkey3'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -64,7 +64,7 @@ t1 CREATE TABLE `t1` (
#change field with option with the same value
alter table t1 change a a int `FKEY1`='v1';
Warnings:
-Warning 1651 Unknown option 'FKEY1'
+Warning 1707 Unknown option 'FKEY1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -74,7 +74,7 @@ t1 CREATE TABLE `t1` (
#change field with option with a different value
alter table t1 change a a int fkey1=v2;
Warnings:
-Warning 1651 Unknown option 'fkey1'
+Warning 1707 Unknown option 'fkey1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -93,7 +93,7 @@ t1 CREATE TABLE `t1` (
#new key with options
alter table t1 add key bkey (b) kkey2=v1;
Warnings:
-Warning 1651 Unknown option 'kkey2'
+Warning 1707 Unknown option 'kkey2'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -105,8 +105,8 @@ t1 CREATE TABLE `t1` (
#new column with options
alter table t1 add column c int fkey1=v1 fkey2=v2;
Warnings:
-Warning 1651 Unknown option 'fkey1'
-Warning 1651 Unknown option 'fkey2'
+Warning 1707 Unknown option 'fkey1'
+Warning 1707 Unknown option 'fkey2'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` (
#add column with options after delete
alter table t1 add column b int fkey2=v1;
Warnings:
-Warning 1651 Unknown option 'fkey2'
+Warning 1707 Unknown option 'fkey2'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -154,7 +154,7 @@ t1 CREATE TABLE `t1` (
#add key
alter table t1 add key bkey (b) kkey2=v2;
Warnings:
-Warning 1651 Unknown option 'kkey2'
+Warning 1707 Unknown option 'kkey2'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -168,7 +168,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a int) tkey1=100;
Warnings:
-Warning 1651 Unknown option 'tkey1'
+Warning 1707 Unknown option 'tkey1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index a76a0a53510..a37d3945ca1 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -516,7 +516,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where (('2007-04-25 18:30:22' = 0))
+Note 1003 select '1' AS `id`,'2007-04-25 18:30:22' AS `cur_date` from (dual) where (('2007-04-25 18:30:22' = 0))
select * from t1
where id in (select id from t1 as x1 where (t1.cur_date is null));
id cur_date
@@ -527,7 +527,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
-Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where (('2007-04-25' = 0))
+Note 1003 select '1' AS `id`,'2007-04-25' AS `cur_date` from (dual) where (('2007-04-25' = 0))
select * from t2
where id in (select id from t2 as x1 where (t2.cur_date is null));
id cur_date
@@ -647,7 +647,7 @@ SET NAMES CP850;
INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12');
EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07';
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ref AtTime AtTime 9 const 1 100.00 Using where
+1 SIMPLE t1 ref AtTime AtTime 9 const 1 100.00
Warnings:
Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = '2010-02-22 18:40:07')
DROP TABLE t1;
diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result
index 98ac5973e6d..80eb4e45a91 100644
--- a/mysql-test/r/type_varchar.result
+++ b/mysql-test/r/type_varchar.result
@@ -476,7 +476,7 @@ a (a DIV 2)
t 0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '1a'
-Warning 1366 Incorrect decimal value: '' for column '' at row -1
+Warning 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: 't '
SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
a CAST(a AS SIGNED)
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 15ee25ab79a..611e807ce8e 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -321,7 +321,7 @@ select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
CAST(a AS DECIMAL(13,5))
0.00000
Warnings:
-Error 1366 Incorrect decimal value: '' for column '' at row 0
+Warning 1366 Incorrect decimal value: '' for column '' at row 0
Warning 1292 Truncated incorrect DECIMAL value: ''
create table t1 (a integer unsigned);
insert into t1 values (1),(-1),(0),(-2);
diff --git a/mysql-test/r/innodb_mrr.result b/mysql-test/r/xtradb_mrr.result
index 7b1c18d2523..7b1c18d2523 100644
--- a/mysql-test/r/innodb_mrr.result
+++ b/mysql-test/r/xtradb_mrr.result