summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/archive.result9
-rw-r--r--mysql-test/r/auto_increment.result12
-rw-r--r--mysql-test/r/bdb_notembedded.result35
-rw-r--r--mysql-test/r/binlog_unsafe.result13
-rw-r--r--mysql-test/r/case.result20
-rw-r--r--mysql-test/r/change_user.result4
-rw-r--r--mysql-test/r/create.result38
-rw-r--r--mysql-test/r/csv.result10
-rw-r--r--mysql-test/r/ctype_big5.result4
-rw-r--r--mysql-test/r/ctype_euckr.result4
-rw-r--r--mysql-test/r/ctype_gb2312.result4
-rw-r--r--mysql-test/r/ctype_gbk.result4
-rw-r--r--mysql-test/r/ctype_uca.result4
-rw-r--r--mysql-test/r/ctype_ucs.result8
-rw-r--r--mysql-test/r/delayed.result6
-rw-r--r--mysql-test/r/drop.result7
-rw-r--r--mysql-test/r/events.result3
-rw-r--r--mysql-test/r/events_scheduling.result4
-rw-r--r--mysql-test/r/explain.result20
-rw-r--r--mysql-test/r/federated.result111
-rw-r--r--mysql-test/r/func_gconcat.result63
-rw-r--r--mysql-test/r/func_group.result12
-rw-r--r--mysql-test/r/func_misc.result20
-rw-r--r--mysql-test/r/func_time.result15
-rw-r--r--mysql-test/r/gis.result40
-rw-r--r--mysql-test/r/grant.result45
-rw-r--r--mysql-test/r/group_by.result36
-rw-r--r--mysql-test/r/group_min_max.result46
-rw-r--r--mysql-test/r/have_community_features.require2
-rw-r--r--mysql-test/r/have_local_infile.require2
-rw-r--r--mysql-test/r/index_merge_myisam.result2
-rw-r--r--mysql-test/r/information_schema.result16
-rw-r--r--mysql-test/r/information_schema_db.result1
-rw-r--r--mysql-test/r/innodb.result34
-rw-r--r--mysql-test/r/innodb_mysql.result77
-rw-r--r--mysql-test/r/insert.result134
-rw-r--r--mysql-test/r/join_outer_innodb.result4
-rw-r--r--mysql-test/r/key.result45
-rw-r--r--mysql-test/r/key_cache.result2
-rw-r--r--mysql-test/r/lock_multi.result30
-rw-r--r--mysql-test/r/log_state.result12
-rw-r--r--mysql-test/r/merge.result37
-rw-r--r--mysql-test/r/merge_innodb.result37
-rw-r--r--mysql-test/r/multi_update.result4
-rw-r--r--mysql-test/r/myisam.result22
-rw-r--r--mysql-test/r/mysqlbinlog.result133
-rw-r--r--mysql-test/r/mysqlbinlog2.result342
-rw-r--r--mysql-test/r/mysqlcheck.result61
-rw-r--r--mysql-test/r/mysqlshow.result2
-rw-r--r--mysql-test/r/mysqlslap.result8
-rw-r--r--mysql-test/r/no-threads.result4
-rw-r--r--mysql-test/r/not_embedded_server.result2
-rw-r--r--mysql-test/r/null.result8
-rw-r--r--mysql-test/r/outfile_loaddata.result18
-rw-r--r--mysql-test/r/packet.result8
-rw-r--r--mysql-test/r/parser.result20
-rw-r--r--mysql-test/r/partition.result110
-rw-r--r--mysql-test/r/partition_archive.result78
-rw-r--r--mysql-test/r/partition_hash.result12
-rw-r--r--mysql-test/r/partition_innodb.result12
-rw-r--r--mysql-test/r/partition_range.result2
-rw-r--r--mysql-test/r/profiling.result415
-rw-r--r--mysql-test/r/ps.result7
-rw-r--r--mysql-test/r/ps_2myisam.result17
-rw-r--r--mysql-test/r/ps_3innodb.result17
-rw-r--r--mysql-test/r/ps_4heap.result17
-rw-r--r--mysql-test/r/ps_5merge.result34
-rw-r--r--mysql-test/r/ps_ddl.result2329
-rw-r--r--mysql-test/r/query_cache_debug.result24
-rw-r--r--mysql-test/r/range.result18
-rw-r--r--mysql-test/r/read_only.result28
-rw-r--r--mysql-test/r/select.result6
-rw-r--r--mysql-test/r/skip_grants.result4
-rw-r--r--mysql-test/r/sp-code.result109
-rw-r--r--mysql-test/r/sp-error.result48
-rw-r--r--mysql-test/r/sp.result58
-rw-r--r--mysql-test/r/sp_trans_log.result1
-rw-r--r--mysql-test/r/status.result24
-rw-r--r--mysql-test/r/strict_autoinc_4bdb.result28
-rw-r--r--mysql-test/r/subselect.result190
-rw-r--r--mysql-test/r/subselect3.result2
-rw-r--r--mysql-test/r/subselect_notembedded.result101
-rw-r--r--mysql-test/r/trigger_notembedded.result14
-rw-r--r--mysql-test/r/type_bit.result12
-rw-r--r--mysql-test/r/type_bit_innodb.result2
-rw-r--r--mysql-test/r/type_blob.result14
-rw-r--r--mysql-test/r/type_date.result44
-rw-r--r--mysql-test/r/type_datetime.result55
-rw-r--r--mysql-test/r/type_decimal.result67
-rw-r--r--mysql-test/r/type_newdecimal.result20
-rw-r--r--mysql-test/r/udf.result27
-rw-r--r--mysql-test/r/udf_skip_grants.result5
-rw-r--r--mysql-test/r/union.result75
-rw-r--r--mysql-test/r/user_var-binlog.result6
-rw-r--r--mysql-test/r/user_var.result7
-rw-r--r--mysql-test/r/variables+c.result7
-rw-r--r--mysql-test/r/variables.result38
-rw-r--r--mysql-test/r/view.result16
-rw-r--r--mysql-test/r/warnings.result3
-rw-r--r--mysql-test/r/windows.result1
100 files changed, 5392 insertions, 376 deletions
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index edd49988a5f..e9eb50fc805 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -12665,7 +12665,7 @@ t6 CREATE TABLE `t6` (
`b` tinyblob,
`c` int(11) DEFAULT NULL,
KEY `a` (`a`)
-) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+) ENGINE=ARCHIVE AUTO_INCREMENT=36 DEFAULT CHARSET=latin1
DROP TABLE t1, t2, t4, t5, t6;
create table t1 (i int) engine=archive;
insert into t1 values (1);
@@ -12687,3 +12687,10 @@ CREATE TABLE t1(a VARCHAR(510)) ENGINE = ARCHIVE;
INSERT INTO t1(a) VALUES ('');
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
+CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b BLOB, KEY(a)) ENGINE=archive;
+INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
+FLUSH TABLE t1;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 NULL
+2 NULL
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 54c2df34a7f..bc9daf43f14 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -231,8 +231,7 @@ a b
204 7
delete from t1 where a=0;
update t1 set a=NULL where b=6;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
update t1 set a=300 where b=7;
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
@@ -247,7 +246,7 @@ a b
1 1
200 2
201 4
-0 6
+203 6
300 7
301 8
400 9
@@ -263,6 +262,7 @@ a b
1 1
200 2
201 4
+203 6
300 7
301 8
400 9
@@ -273,20 +273,20 @@ a b
405 14
delete from t1 where a=0;
update t1 set a=NULL where b=13;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
update t1 set a=500 where b=14;
select * from t1 order by b;
a b
1 1
200 2
201 4
+203 6
300 7
301 8
400 9
401 10
402 11
-0 13
+404 13
500 14
drop table t1;
create table t1 (a bigint);
diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result
deleted file mode 100644
index 14cb5fad915..00000000000
--- a/mysql-test/r/bdb_notembedded.result
+++ /dev/null
@@ -1,35 +0,0 @@
-set autocommit=1;
-reset master;
-create table bug16206 (a int);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
-f n Query 1 n use `test`; create table bug16206 (a int)
-f n Query 1 n use `test`; insert into bug16206 values(1)
-f n Query 1 n use `test`; insert into bug16206 values(2)
-drop table bug16206;
-reset master;
-create table bug16206 (a int) engine= bdb;
-insert into bug16206 values(0);
-insert into bug16206 values(1);
-start transaction;
-insert into bug16206 values(2);
-commit;
-insert into bug16206 values(3);
-show binlog events;
-Log_name Pos Event_type Server_id End_log_pos Info
-f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
-f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
-f n Query 1 n use `test`; insert into bug16206 values(0)
-f n Query 1 n use `test`; insert into bug16206 values(1)
-f n Query 1 n use `test`; BEGIN
-f n Query 1 n use `test`; insert into bug16206 values(2)
-f n Query 1 n use `test`; COMMIT
-f n Query 1 n use `test`; insert into bug16206 values(3)
-drop table bug16206;
-set autocommit=0;
-End of 5.0 tests
diff --git a/mysql-test/r/binlog_unsafe.result b/mysql-test/r/binlog_unsafe.result
deleted file mode 100644
index 47284ed8bc3..00000000000
--- a/mysql-test/r/binlog_unsafe.result
+++ /dev/null
@@ -1,13 +0,0 @@
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TABLE t1 (a CHAR(40));
-CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY);
-CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3;
-INSERT INTO t1 SELECT UUID();
-Warnings:
-Warning 1592 Statement is not safe to log in statement format.
-SHOW WARNINGS;
-Level Warning
-Code 1592
-Message Statement is not safe to log in statement format.
-DROP TABLE t1,t2,t3;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 9ee64ee6dbd..d408a0b6153 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2;
+drop table if exists t1, t2;
select CASE "b" when "a" then 1 when "b" then 2 END;
CASE "b" when "a" then 1 when "b" then 2 END
2
@@ -200,3 +200,21 @@ CEMPNUM EMPMUM1 EMPNUM2
0.00 0 0.00
2.00 2 NULL
DROP TABLE t1,t2;
+End of 4.1 tests
+create table t1 (a int, b bigint unsigned);
+create table t2 (c int);
+insert into t1 (a, b) values (1,4572794622775114594), (2,18196094287899841997),
+(3,11120436154190595086);
+insert into t2 (c) values (1), (2), (3);
+select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1
+join t2 on t1.a=t2.c order by d;
+a d
+1 4572794622775114594
+3 11120436154190595086
+2 18196094287899841997
+select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1
+join t2 on t1.a=t2.c where b=11120436154190595086 order by d;
+a d
+3 11120436154190595086
+drop table t1, t2;
+End of 5.0 tests
diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result
index cb409621d56..28b55dfd5e5 100644
--- a/mysql-test/r/change_user.result
+++ b/mysql-test/r/change_user.result
@@ -4,14 +4,14 @@ SELECT @@session.sql_big_selects;
1
SELECT @@global.max_join_size;
@@global.max_join_size
--1
+18446744073709551615
change_user
SELECT @@session.sql_big_selects;
@@session.sql_big_selects
1
SELECT @@global.max_join_size;
@@global.max_join_size
--1
+18446744073709551615
SET @@global.max_join_size = 10000;
SET @@session.max_join_size = default;
change_user
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 73a9dba4e69..0613c9ba488 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1705,4 +1705,42 @@ create table t1 as select 1;
create table t2 as select f1() from t1;
drop table t1,t2;
drop function f1;
+create table t1 like information_schema.processlist;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ID` bigint(4) NOT NULL DEFAULT '0',
+ `USER` varchar(16) NOT NULL DEFAULT '',
+ `HOST` varchar(64) NOT NULL DEFAULT '',
+ `DB` varchar(64) DEFAULT NULL,
+ `COMMAND` varchar(16) NOT NULL DEFAULT '',
+ `TIME` bigint(7) NOT NULL DEFAULT '0',
+ `STATE` varchar(64) DEFAULT NULL,
+ `INFO` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+drop table t1;
+create temporary table t1 like information_schema.processlist;
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `ID` bigint(4) NOT NULL DEFAULT '0',
+ `USER` varchar(16) NOT NULL DEFAULT '',
+ `HOST` varchar(64) NOT NULL DEFAULT '',
+ `DB` varchar(64) DEFAULT NULL,
+ `COMMAND` varchar(16) NOT NULL DEFAULT '',
+ `TIME` bigint(7) NOT NULL DEFAULT '0',
+ `STATE` varchar(64) DEFAULT NULL,
+ `INFO` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+drop table t1;
+create table t1 like information_schema.character_sets;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
+ `DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
+ `MAXLEN` bigint(3) NOT NULL DEFAULT '0'
+) ENGINE=MEMORY DEFAULT CHARSET=utf8
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index 69f77dc3cd8..b0033383f00 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -5364,13 +5364,19 @@ BIN(a)
0
drop table t1;
create table t1(a enum('foo','bar') default null) engine=csv;
-ERROR HY000: Can't create table 'test.t1' (errno: -1)
+ERROR 42000: The storage engine for the table doesn't support nullable columns
create table t1(a enum('foo','bar') default 'foo') engine=csv;
-ERROR HY000: Can't create table 'test.t1' (errno: -1)
+ERROR 42000: The storage engine for the table doesn't support nullable columns
create table t1(a enum('foo','bar') default 'foo' not null) engine=csv;
insert into t1 values();
select * from t1;
a
foo
drop table t1;
+CREATE TABLE t1(a INT) ENGINE=CSV;
+ERROR 42000: The storage engine for the table doesn't support nullable columns
+SHOW WARNINGS;
+Level Code Message
+Error 1178 The storage engine for the table doesn't support nullable columns
+Error 1005 Can't create table 'test.t1' (errno: 138)
End of 5.1 tests
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index b190273cc64..8103e9b856f 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -64,6 +64,10 @@ select a sounds like a from t1;
a sounds like a
1
1
+select 1 from t1 order by cast(a as char(1));
+1
+1
+1
drop table t1;
DROP DATABASE d1;
USE test;
diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result
index ee786202c01..bb1b3f5995b 100644
--- a/mysql-test/r/ctype_euckr.result
+++ b/mysql-test/r/ctype_euckr.result
@@ -64,6 +64,10 @@ select a sounds like a from t1;
a sounds like a
1
1
+select 1 from t1 order by cast(a as char(1));
+1
+1
+1
drop table t1;
DROP DATABASE d1;
USE test;
diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result
index 90c94c3b299..95246525368 100644
--- a/mysql-test/r/ctype_gb2312.result
+++ b/mysql-test/r/ctype_gb2312.result
@@ -64,6 +64,10 @@ select a sounds like a from t1;
a sounds like a
1
1
+select 1 from t1 order by cast(a as char(1));
+1
+1
+1
drop table t1;
DROP DATABASE d1;
USE test;
diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result
index fe90c7bff29..8437e34be1e 100644
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@ -64,6 +64,10 @@ select a sounds like a from t1;
a sounds like a
1
1
+select 1 from t1 order by cast(a as char(1));
+1
+1
+1
drop table t1;
DROP DATABASE d1;
USE test;
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 3fff9b9cda8..92b76802d0b 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -2599,6 +2599,10 @@ select a sounds like a from t1;
a sounds like a
1
1
+select 1 from t1 order by cast(a as char(1));
+1
+1
+1
drop table t1;
DROP DATABASE d1;
USE test;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 991c3bb82de..bd76f2a859f 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -811,6 +811,14 @@ quote(name)
????????
????????????????
drop table bug20536;
+set names ucs2;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
+set names ucs2 collate ucs2_bin;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
+set character_set_client= ucs2;
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
+set character_set_client= concat('ucs', substr('2', 1));
+ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
INSERT INTO t1 VALUES('abcd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 95f7fe5aa61..bcda6ddb6ab 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -250,6 +250,11 @@ SELECT HEX(a) FROM t1;
HEX(a)
1
DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT DELAYED INTO t1 SET b= b();
+ERROR 42S22: Unknown column 'b' in 'field list'
+DROP TABLE t1;
+End of 5.0 tests
DROP TABLE IF EXISTS t1,t2;
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE `t1` (
@@ -279,3 +284,4 @@ ERROR 22007: Incorrect date value: '0000-00-00' for column 'f1' at row 1
INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
ERROR 22007: Incorrect date value: '2007-00-00' for column 'f1' at row 1
DROP TABLE t1,t2;
+End of 5.1 tests
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index ff11905aa34..71d6fcc7cd0 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -85,3 +85,10 @@ select 1;
1
unlock tables;
End of 5.0 tests
+create database mysql_test;
+create table mysql_test.t1(f1 int);
+create table mysql_test.`#sql-347f_7` (f1 int);
+create table mysql_test.`#sql-347f_8` (f1 int);
+drop table mysql_test.`#sql-347f_8`;
+drop database mysql_test;
+End of 5.1 tests
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result
index d1ee6d1c5a1..7b68914e219 100644
--- a/mysql-test/r/events.result
+++ b/mysql-test/r/events.result
@@ -403,9 +403,10 @@ ERROR 42S02: Table 'mysql.event' doesn't exist
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
-Error 1146 Table 'mysql.event' doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
+Warnings:
+Error 1146 Table 'mysql.event' doesn't exist
OK, there is an unnecessary warning about the non-existent table
but it's not easy to fix and no one complained about it.
A similar warning is printed if mysql.proc is missing.
diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result
index d45bffcd7ff..033136ba354 100644
--- a/mysql-test/r/events_scheduling.result
+++ b/mysql-test/r/events_scheduling.result
@@ -78,10 +78,10 @@ FROM INFORMATION_SCHEMA.EVENTS
WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR')
OK
-SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR')
+SELECT IF(LAST_EXECUTED-ENDS <= 0, 'OK', 'ERROR')
FROM INFORMATION_SCHEMA.EVENTS
WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
-IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR')
+IF(LAST_EXECUTED-ENDS <= 0, 'OK', 'ERROR')
OK
"Already dropped because ended. Therefore an error."
DROP EVENT event_3;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 6f348447fbb..2ce8b8c384f 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -87,3 +87,23 @@ Warnings:
Note 1003 select '1' AS `f1`,'1' AS `f2` from `test`.`t1` having 1
drop view v1;
drop table t1;
+CREATE TABLE t1(c INT);
+INSERT INTO t1 VALUES (),();
+CREATE TABLE t2 (b INT,
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
+KEY(b),KEY(b),KEY(b),KEY(b),KEY(b));
+INSERT INTO t2 VALUES (),(),();
+EXPLAIN SELECT 1 FROM
+(SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2;
+id select_type table type possible_keys key key_len ref rows Extra
+X X X X X X X X X const row not found
+X X X X X X X X X
+X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF)
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 8f1fe20ea3b..00287338459 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -1955,6 +1955,117 @@ a
2
DROP TABLE federated.t1;
DROP TABLE federated.t1;
+create table t1 (a varchar(256));
+drop view if exists v1;
+create view v1 as select a from t1;
+create table t1
+(a varchar(256)) engine=federated
+connection='mysql://root@127.0.0.1:SLAVE_PORT/test/v1';
+select 1 from t1 order by a;
+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
+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
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+drop table t1;
+drop table t1;
+drop view v1;
End of 5.1 tests
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index d257e526abf..b5bfadf1f57 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -271,7 +271,7 @@ group_concat(distinct s1 order by s2)
c,b,a
select group_concat(distinct s1 order by s2) from t1;
group_concat(distinct s1 order by s2)
-c,b,a,c
+c,b,a
drop table t1;
create table t1 (a int, c int);
insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
@@ -876,4 +876,65 @@ select group_concat(f1) from t1;
group_concat(f1)
,
drop table t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1, 1), (2, 2), (2, 3);
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+GROUP_CONCAT(DISTINCT a ORDER BY b)
+1,2
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b DESC) FROM t1;
+GROUP_CONCAT(DISTINCT a ORDER BY b DESC)
+2,1
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+GROUP_CONCAT(DISTINCT a)
+1,2
+SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY 3 - b) FROM t1;
+GROUP_CONCAT(DISTINCT a + 1 ORDER BY 3 - b)
+3,2
+SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY b) FROM t1;
+GROUP_CONCAT(DISTINCT a + 1 ORDER BY b)
+2,3
+SELECT GROUP_CONCAT(a ORDER BY 3 - b) FROM t1;
+GROUP_CONCAT(a ORDER BY 3 - b)
+2,2,1
+CREATE TABLE t2 (a INT, b INT, c INT, d INT);
+INSERT INTO t2 VALUES (1,1, 1,1), (1,1, 2,2), (1,2, 2,1), (2,1, 1,2);
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, d) FROM t2;
+GROUP_CONCAT(DISTINCT a, b ORDER BY c, d)
+11,21,12
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY d, c) FROM t2;
+GROUP_CONCAT(DISTINCT a, b ORDER BY d, c)
+11,12,21
+CREATE TABLE t3 (a INT, b INT, c INT);
+INSERT INTO t3 VALUES (1, 1, 1), (2, 1, 2), (3, 2, 1);
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, c) FROM t3;
+GROUP_CONCAT(DISTINCT a, b ORDER BY b, c)
+11,21,32
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, b) FROM t3;
+GROUP_CONCAT(DISTINCT a, b ORDER BY c, b)
+11,32,21
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a, b) FROM t1;
+GROUP_CONCAT(DISTINCT a, b ORDER BY a, b)
+11,22,23
+SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1;
+GROUP_CONCAT(DISTINCT b, a ORDER BY a, b)
+11,22,32
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, a) FROM t1;
+GROUP_CONCAT(DISTINCT a, b ORDER BY b, a)
+11,22,23
+SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1;
+GROUP_CONCAT(DISTINCT b, a ORDER BY a, b)
+11,22,32
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY a, b) FROM t1;
+GROUP_CONCAT(DISTINCT a ORDER BY a, b)
+1,2
+SELECT GROUP_CONCAT(DISTINCT b ORDER BY b, a) FROM t1;
+GROUP_CONCAT(DISTINCT b ORDER BY b, a)
+1,2,3
+SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a) FROM t1;
+GROUP_CONCAT(DISTINCT a, b ORDER BY a)
+11,23,22
+SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
+GROUP_CONCAT(DISTINCT b, a ORDER BY b)
+11,22,32
+DROP TABLE t1, t2, t3;
End of 5.0 tests
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index abf717091af..4c1abb160c6 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1398,4 +1398,16 @@ SELECT COUNT(*), a FROM t1;
COUNT(*) a
4 1
DROP TABLE t1;
+set SQL_MODE=ONLY_FULL_GROUP_BY;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1;
+EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
+Warnings:
+Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.`t1`.`a` + 1)
+DROP VIEW v1;
+DROP TABLE t1;
+SET SQL_MODE=DEFAULT;
End of 5.0 tests
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index aa75cde0525..745a340ec94 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, t2;
select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
format(1.5555,0) format(123.5555,1) format(1234.5555,2) format(12345.55555,3) format(123456.5555,4) format(1234567.5555,5) format("12345.2399",2)
2 123.6 1,234.56 12,345.556 123,456.5555 1,234,567.55550 12,345.24
@@ -212,6 +212,24 @@ test
SELECT NAME_CONST('test', 'test');
test
test
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (5), (2);
+SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
+ERROR HY000: Incorrect arguments to NAME_CONST
+DROP TABLE t1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (), (), ();
+SELECT NAME_CONST(a, '1') FROM t1;
+ERROR HY000: Incorrect arguments to NAME_CONST
+SET INSERT_ID= NAME_CONST(a, a);
+ERROR HY000: Incorrect arguments to NAME_CONST
+DROP TABLE t1;
+create table t1 (a int not null);
+insert into t1 values (-1), (-2);
+select min(a) from t1 group by inet_ntoa(a);
+min(a)
+-2
+drop table t1;
End of 5.0 tests
select connection_id() > 0;
connection_id() > 0
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index a355d7929b5..4dd8fb1531d 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1246,6 +1246,21 @@ select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'concat'
set lc_time_names=en_US;
drop table t1;
+select DATE_ADD('20071108181000', INTERVAL 1 DAY);
+DATE_ADD('20071108181000', INTERVAL 1 DAY)
+2007-11-09 18:10:00
+select DATE_ADD(20071108181000, INTERVAL 1 DAY);
+DATE_ADD(20071108181000, INTERVAL 1 DAY)
+2007-11-09 18:10:00
+select DATE_ADD('20071108', INTERVAL 1 DAY);
+DATE_ADD('20071108', INTERVAL 1 DAY)
+2007-11-09
+select DATE_ADD(20071108, INTERVAL 1 DAY);
+DATE_ADD(20071108, INTERVAL 1 DAY)
+2007-11-09
+select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
+LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND
+2007-12-30 23:59:59
End of 5.0 tests
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 61394409947..73fb9cc69e0 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -680,7 +680,7 @@ def test t1 t1 g g 255 4294967295 0 Y 144 0 63
g
select asbinary(g) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def asbinary(g) 252 16777216 0 Y 128 0 63
+def asbinary(g) 252 4294967295 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
@@ -742,6 +742,38 @@ select geomfromtext(col9,col89) as a from t1;
a
NULL
DROP TABLE t1;
+CREATE TABLE t1 (
+geomdata polygon NOT NULL,
+SPATIAL KEY index_geom (geomdata)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
+CREATE TABLE t2 (
+geomdata polygon NOT NULL,
+SPATIAL KEY index_geom (geomdata)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
+CREATE TABLE t3
+select
+aswkb(ws.geomdata) AS geomdatawkb
+from
+t1 ws
+union
+select
+aswkb(ws.geomdata) AS geomdatawkb
+from
+t2 ws;
+describe t3;
+Field Type Null Key Default Extra
+geomdatawkb longblob YES NULL
+drop table t1;
+drop table t2;
+drop table t3;
+create table t1(col1 geometry default null,col15 geometrycollection not
+null,spatial index(col15),index(col1(15)))engine=myisam;
+insert into t1 set col15 = GeomFromText('POINT(6 5)');
+insert into t1 set col15 = GeomFromText('POINT(6 5)');
+check table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
End of 4.1 tests
create table t1 (s1 geometry not null,s2 char(100));
create trigger t1_bu before update on t1 for each row set new.s1 = null;
@@ -934,6 +966,12 @@ COUNT(*)
2
DROP TABLE t1, t2;
End of 5.0 tests
+create table `t1` (`col002` point)engine=myisam;
+insert into t1 values (),(),();
+select min(`col002`) from t1 union select `col002` from t1;
+min(`col002`)
+NULL
+drop table t1;
End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 0d40778d5f2..0df3ac6de8a 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1194,6 +1194,7 @@ ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table '
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
+DROP USER mysqltest_2@localhost;
use test;
CREATE TABLE t1 (f1 int, f2 int);
INSERT INTO t1 VALUES(1,1), (2,2);
@@ -1213,6 +1214,7 @@ f1 f2
REVOKE UPDATE (f1) ON `test`.`t1` FROM 'mysqltest_1'@'localhost';
REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
+DROP USER mysqltest_1@localhost;
DROP DATABASE db27878;
use test;
DROP TABLE t1;
@@ -1226,12 +1228,48 @@ drop user юзер_юзер@localhost;
grant select on test.* to очень_длинный_юзер@localhost;
ERROR HY000: String 'очень_длинный_юзер' is too long for user name (should be no longer than 16)
set names default;
+create database mysqltest;
+use mysqltest;
+grant create on mysqltest.* to mysqltest@localhost;
+create table t1 (i INT);
+insert into t1 values (1);
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+create table t2 (i INT);
+create table t4 (i INT);
+grant select, insert on mysqltest.t2 to mysqltest@localhost;
+grant insert on mysqltest.t4 to mysqltest@localhost;
+grant create, insert on mysqltest.t5 to mysqltest@localhost;
+grant create, insert on mysqltest.t6 to mysqltest@localhost;
+flush privileges;
+insert into t2 values (1);
+create table if not exists t1 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+create table if not exists t3 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't3'
+create table if not exists t4 select * from t2;
+Warnings:
+Note 1050 Table 't4' already exists
+create table if not exists t5 select * from t2;
+create table t6 select * from t2;
+create table t7 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't7'
+create table t4 select * from t2;
+ERROR 42S01: Table 't4' already exists
+create table t1 select * from t2;
+ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1'
+drop table t1,t2,t4,t5,t6;
+revoke create on mysqltest.* from mysqltest@localhost;
+revoke select, insert on mysqltest.t2 from mysqltest@localhost;
+revoke insert on mysqltest.t4 from mysqltest@localhost;
+revoke create, insert on mysqltest.t5 from mysqltest@localhost;
+revoke create, insert on mysqltest.t6 from mysqltest@localhost;
+drop user mysqltest@localhost;
+drop database mysqltest;
+use test;
FLUSH PRIVILEGES without procs_priv table.
RENAME TABLE mysql.procs_priv TO mysql.procs_gone;
FLUSH PRIVILEGES;
-Warnings:
-Error 1146 Table 'mysql.procs_priv' doesn't exist
-Error 1548 Cannot load from mysql.mysql.procs_priv. The table is probably corrupted
+ERROR 42S02: Table 'mysql.procs_priv' doesn't exist
Assigning privileges without procs_priv table.
CREATE DATABASE mysqltest1;
CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
@@ -1245,3 +1283,4 @@ CALL mysqltest1.test();
DROP DATABASE mysqltest1;
RENAME TABLE mysql.procs_gone TO mysql.procs_priv;
FLUSH PRIVILEGES;
+End of 5.1 tests
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 1472fdfdd7a..268f290ddca 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1478,3 +1478,39 @@ NULL
1
2
DROP TABLE t1;
+CREATE TABLE t1 ( a INT, b INT );
+SELECT b c, (SELECT a FROM t1 WHERE b = c)
+FROM t1;
+c (SELECT a FROM t1 WHERE b = c)
+SELECT b c, (SELECT a FROM t1 WHERE b = c)
+FROM t1
+HAVING b = 10;
+c (SELECT a FROM t1 WHERE b = c)
+SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c)
+FROM t1
+HAVING b = 10;
+ERROR 42S22: Reference 'c' not supported (reference to group function)
+SET @old_sql_mode = @@sql_mode;
+SET @@sql_mode='ONLY_FULL_GROUP_BY';
+SELECT b c, (SELECT a FROM t1 WHERE b = c)
+FROM t1;
+c (SELECT a FROM t1 WHERE b = c)
+SELECT b c, (SELECT a FROM t1 WHERE b = c)
+FROM t1
+HAVING b = 10;
+ERROR 42000: non-grouping field 'b' is used in HAVING clause
+SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c)
+FROM t1
+HAVING b = 10;
+ERROR 42S22: Reference 'c' not supported (reference to group function)
+INSERT INTO t1 VALUES (1, 1);
+SELECT b c, (SELECT a FROM t1 WHERE b = c)
+FROM t1;
+c (SELECT a FROM t1 WHERE b = c)
+1 1
+INSERT INTO t1 VALUES (2, 1);
+SELECT b c, (SELECT a FROM t1 WHERE b = c)
+FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1;
+SET @@sql_mode = @old_sql_mode;
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index a3744b36e87..103a7f5515a 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2326,3 +2326,49 @@ a
2
4
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3);
+INSERT INTO t1 SELECT a + 1, b FROM t1;
+INSERT INTO t1 SELECT a + 2, b FROM t1;
+EXPLAIN
+SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort
+SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
+a MIN(b) MAX(b)
+4 1 3
+3 1 3
+2 1 3
+1 1 3
+CREATE INDEX break_it ON t1 (a, b);
+EXPLAIN
+SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by
+SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
+a MIN(b) MAX(b)
+1 1 3
+2 1 3
+3 1 3
+4 1 3
+EXPLAIN
+SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by; Using temporary; Using filesort
+SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
+a MIN(b) MAX(b)
+4 1 3
+3 1 3
+2 1 3
+1 1 3
+EXPLAIN
+SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
+SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
+a MIN(b) MAX(b) AVG(b)
+4 1 3 2.0000
+3 1 3 2.0000
+2 1 3 2.0000
+1 1 3 2.0000
+DROP TABLE t1;
diff --git a/mysql-test/r/have_community_features.require b/mysql-test/r/have_community_features.require
new file mode 100644
index 00000000000..9233bba91e1
--- /dev/null
+++ b/mysql-test/r/have_community_features.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_community_features YES
diff --git a/mysql-test/r/have_local_infile.require b/mysql-test/r/have_local_infile.require
new file mode 100644
index 00000000000..124540f7b77
--- /dev/null
+++ b/mysql-test/r/have_local_infile.require
@@ -0,0 +1,2 @@
+Variable_name Value
+local_infile ON
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index 9d7d06f7f1b..1827871861e 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -342,6 +342,8 @@ create table t4 (a int);
insert into t4 values (1),(4),(3);
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size= 4000;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '4000'
explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5)
from t0 as A force index(i1,i2), t0 as B force index (i1,i2)
where (A.key1 < 500000 or A.key2 < 3)
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 4df3b56da86..ddc0e189cd2 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -50,6 +50,7 @@ KEY_COLUMN_USAGE
PARTITIONS
PLUGINS
PROCESSLIST
+PROFILING
REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
@@ -851,7 +852,7 @@ delete from mysql.db where user='mysqltest_4';
flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 27
+information_schema 28
mysql 22
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
@@ -1147,7 +1148,7 @@ group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
varchar(27) information_schema.COLUMNS 1
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
-varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS 5
+varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PROFILING 6
create table t1(f1 char(1) not null, f2 char(9) not null)
default character set utf8;
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
@@ -1252,6 +1253,7 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
+PROFILING QUERY_ID
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME
@@ -1294,6 +1296,7 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
+PROFILING QUERY_ID
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
ROUTINES ROUTINE_SCHEMA
SCHEMATA SCHEMA_NAME
@@ -1387,6 +1390,7 @@ KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
PARTITIONS information_schema.PARTITIONS 1
PLUGINS information_schema.PLUGINS 1
PROCESSLIST information_schema.PROCESSLIST 1
+PROFILING information_schema.PROFILING 1
REFERENTIAL_CONSTRAINTS information_schema.REFERENTIAL_CONSTRAINTS 1
ROUTINES information_schema.ROUTINES 1
SCHEMATA information_schema.SCHEMATA 1
@@ -1611,4 +1615,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE tables ALL NULL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases
Warnings:
Note 1003 select 1 AS `1` from `information_schema`.`tables`
+use information_schema;
+show events;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+show events from information_schema;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+show events where Db= 'information_schema';
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+use test;
End of 5.1 tests.
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 2da4e305b01..cb56fb3d5cc 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -19,6 +19,7 @@ KEY_COLUMN_USAGE
PARTITIONS
PLUGINS
PROCESSLIST
+PROFILING
REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 4379959b60d..d0c586de8d4 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -925,7 +925,7 @@ 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
+1 SIMPLE t1 index NULL PRIMARY 4 NULL #
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 #
@@ -1153,14 +1153,14 @@ 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
+102 2
+103 3
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;
@@ -1184,7 +1184,6 @@ a b
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
@@ -1196,10 +1195,11 @@ a b
110 10
111 11
112 12
+201 1
update t1,t2 set t1.b=t1.b+10 where t1.b=2;
select * from t1;
a b
-201 1
+102 12
103 3
104 4
105 5
@@ -1209,34 +1209,34 @@ a b
109 9
110 10
111 11
-102 12
112 12
+201 1
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
+102 12
103 5
104 6
-106 6
105 7
+106 6
107 7
108 8
109 9
110 10
111 11
-102 12
112 12
+201 1
select * from t2;
a b
1 1
2 2
+3 13
+4 14
+5 15
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;
@@ -1287,11 +1287,11 @@ 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
+1 69
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);
@@ -1768,6 +1768,8 @@ show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 8
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
@@ -1787,6 +1789,8 @@ 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
@@ -2420,8 +2424,8 @@ insert into t1 (b) values (1);
replace into t1 (b) values (2), (1), (3);
select * from t1;
a b
-3 1
2 2
+3 1
4 3
truncate table t1;
insert into t1 (b) values (1);
@@ -2430,8 +2434,8 @@ replace into t1 (b) values (1);
replace into t1 (b) values (3);
select * from t1;
a b
-3 1
2 2
+3 1
4 3
drop table t1;
create table t1 (rowid int not null auto_increment, val int not null,primary
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 75bca880305..e9f00a667c0 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1,3 +1,5 @@
+set global innodb_support_xa=default;
+set session innodb_support_xa=default;
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
drop procedure if exists p1;
@@ -353,13 +355,13 @@ EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
+1 SIMPLE t1 index PRIMARY,name PRIMARY 4 NULL 3 Using where
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%' OR FALSE;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 5
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
CREATE TABLE t1 (
@@ -675,6 +677,8 @@ INSERT INTO t1(b,c) SELECT b,c FROM t2;
UPDATE t2 SET c='2007-01-03';
INSERT INTO t1(b,c) SELECT b,c FROM t2;
set @@sort_buffer_size=8192;
+Warnings:
+Warning 1292 Truncated incorrect sort_buffer_size value: '8192'
SELECT COUNT(*) FROM t1;
COUNT(*)
3072
@@ -1264,11 +1268,11 @@ select_type SIMPLE
table t1
type index
possible_keys NULL
-key b
-key_len 5
+key PRIMARY
+key_len 4
ref NULL
rows 3
-Extra Using index; Using filesort
+Extra Using filesort
SELECT * FROM t1 ORDER BY b ASC, a DESC;
a b
1 1
@@ -1280,11 +1284,11 @@ select_type SIMPLE
table t1
type index
possible_keys NULL
-key b
-key_len 5
+key PRIMARY
+key_len 4
ref NULL
rows 3
-Extra Using index; Using filesort
+Extra Using filesort
SELECT * FROM t1 ORDER BY b DESC, a ASC;
a b
2 2
@@ -1325,6 +1329,33 @@ test t1 Redundant
# - that's it, cleanup.
DROP TABLE t1;
+create table t1(a char(10) not null, unique key aa(a(1)),
+b char(4) not null, unique key bb(b(4))) engine=innodb;
+desc t1;
+Field Type Null Key Default Extra
+a char(10) NO UNI NULL
+b char(4) NO PRI NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) NOT NULL,
+ `b` char(4) NOT NULL,
+ UNIQUE KEY `bb` (`b`),
+ UNIQUE KEY `aa` (`a`(1))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2);
+EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL idx NULL NULL NULL 4 Using where; Using filesort
+SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+id type d
+191 member 1
+NULL member 3
+NULL member 4
+DROP TABLE t1;
End of 5.0 tests
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
@@ -1573,4 +1604,34 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
+create table t1 (a int auto_increment primary key) engine=innodb;
+alter table t1 order by a;
+Warnings:
+Warning 1105 ORDER BY ignored as there is a user-defined clustered index in the table 't1'
+drop table t1;
+CREATE TABLE t1
+(vid integer NOT NULL,
+tid integer NOT NULL,
+idx integer NOT NULL,
+name varchar(128) NOT NULL,
+type varchar(128) NULL,
+PRIMARY KEY(idx, vid, tid),
+UNIQUE(vid, tid, name)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1,1,1,'pk',NULL),(2,1,1,'pk',NULL),(3,1,1,'pk',NULL),(4,1,1,'c1',NULL),
+(5,1,1,'pk',NULL),(1,1,2,'c1',NULL),(2,1,2,'c1',NULL),(3,1,2,'c1',NULL),
+(4,1,2,'c2',NULL),(5,1,2,'c1',NULL),(2,1,3,'c2',NULL),(3,1,3,'c2',NULL),
+(4,1,3,'pk',NULL),(5,1,3,'c2',NULL),
+(2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL);
+EXPLAIN SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index vid PRIMARY 12 NULL 16 Using where
+SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
+vid tid idx name type
+3 1 4 c_extra NULL
+3 1 3 c2 NULL
+3 1 2 c1 NULL
+3 1 1 pk NULL
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 8dbba4d454a..919aff4bfb7 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -499,4 +499,138 @@ i
2
2
DROP TABLE t1, t2;
+CREATE TABLE t1 (
+a char(20) NOT NULL,
+b char(7) DEFAULT NULL,
+c char(4) DEFAULT NULL
+);
+INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
+INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
+INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
+INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
+INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
+INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
+INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
+INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
+INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
+INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
+INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
+INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
+INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
+INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
+INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
+INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
+INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
+INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+SELECT * FROM t1;
+a b c
+9.999999 10 10
+1.225e-05 1.2e-05 1e-0
+0.0001225 0.00012 NULL
+0.1225 0.1225 NULL
+0.1225877 0.12259 NULL
+12.25 12.25 NULL
+12.25 12.25 12.2
+122500 122500 NULL
+12250000000 1.2e+10 NULL
+1.225e+15 1.2e+15 NULL
+5000000 5000000 NULL
+1.25e+78 1.2e+78 NULL
+1.25e-94 1.2e-94 NULL
+1.25e+203 1e+203 NULL
+1.25e-175 1e-175 NULL
+1.225 NULL 1.23
+1.37 NULL 1.37
+-1.37 NULL -1.3
+0.00187 NULL 0.00
+-0.0187 NULL -0.0
+5000 NULL 5000
+-5000 NULL -500
+DROP TABLE t1;
+CREATE TABLE t1 (
+a char(20) NOT NULL,
+b char(7) DEFAULT NULL,
+c char(5)
+);
+INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
+INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
+INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
+INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
+INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
+INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
+INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
+INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
+INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
+INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
+INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
+INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
+INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
+INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
+INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
+INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
+INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
+INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
+INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
+INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
+INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
+SELECT * FROM t1;
+a b c
+9.999999 10 9.999
+1.225e-05 1.2e-05 1e-05
+0.0001225 0.00012 NULL
+0.1225 0.1225 NULL
+0.1225877 0.12259 NULL
+12.25 12.25 NULL
+12.25 12.25 12.25
+122500 122500 NULL
+12250000000 1.2e+10 NULL
+1.225e+15 1.2e+15 NULL
+5000000 5000000 NULL
+1.25e+78 1.2e+78 NULL
+1.25e-94 1.2e-94 NULL
+1.25e+203 1e+203 NULL
+1.25e-175 1e-175 NULL
+1.225 NULL 1.225
+1.37 NULL 1.37
+-1.37 NULL -1.37
+0.00187 NULL 0.002
+-0.0187 NULL -0.01
+5000 NULL 5000
+-5000 NULL -5000
+DROP TABLE t1;
+CREATE TABLE t (a CHAR(10),b INT);
+INSERT INTO t VALUES (),(),();
+INSERT INTO t(a) SELECT rand() FROM t;
+DROP TABLE t;
+CREATE TABLE t1 (c1 INT NOT NULL);
+INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500),
+('4188.32999999999992724042385816574096679687500'), (4188);
+SELECT * FROM t1;
+c1
+4188
+4188
+4188
+CREATE TABLE t2 (c1 BIGINT);
+INSERT INTO t2 VALUES('15449237462.0000000000');
+SELECT * FROM t2;
+c1
+15449237462
+DROP TABLE t1, t2;
End of 5.0 tests.
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
index e8a2d6f668b..24a11b12b03 100644
--- a/mysql-test/r/join_outer_innodb.result
+++ b/mysql-test/r/join_outer_innodb.result
@@ -8,12 +8,12 @@ EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index
+1 SIMPLE t1 index PRIMARY,name PRIMARY 4 NULL 3 Using where
1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index
EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%' OR FALSE;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 5
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 3db5e926d30..fcc09a0244d 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -530,6 +530,51 @@ ORDER BY c.b, c.d
a b c d e f g h i j a b c d
2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL
DROP TABLE t1, t2;
+create table t1(a int not null, key aa(a),
+b char(10) not null, unique key bb(b(1)),
+c char(4) not null, unique key cc(c));
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO MUL NULL
+b char(10) NO UNI NULL
+c char(4) NO PRI NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` char(10) NOT NULL,
+ `c` char(4) NOT NULL,
+ UNIQUE KEY `cc` (`c`),
+ UNIQUE KEY `bb` (`b`(1)),
+ KEY `aa` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int not null, key aa(a),
+b char(10) not null, unique key bb(b(1)),
+c char(4) not null);
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO MUL NULL
+b char(10) NO UNI NULL
+c char(4) NO NULL
+alter table t1 add unique key cc(c);
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO MUL NULL
+b char(10) NO UNI NULL
+c char(4) NO PRI NULL
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` char(10) NOT NULL,
+ `c` char(4) NOT NULL,
+ UNIQUE KEY `cc` (`c`),
+ UNIQUE KEY `bb` (`b`(1)),
+ KEY `aa` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+End of 5.0 tests
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT);
INSERT INTO t1 VALUES (), (), ();
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index 08d8059f61b..9ada5dc0784 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -276,6 +276,8 @@ Variable_name Value
Key_blocks_unused KEY_BLOCKS_UNUSED
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
+Warnings:
+Warning 1292 Truncated incorrect key_buffer_size value: '100'
set global keycache3.key_buffer_size=0;
create table t1 (mytext text, FULLTEXT (mytext));
insert t1 values ('aaabbb');
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index 4a0f70a7b88..9c4f1b17dcc 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -113,4 +113,34 @@ handler t1 open;
ERROR HY000: Table storage engine for 't1' doesn't have this option
--> client 1
drop table t1;
+drop table if exists t1;
+create table t1 (i int);
+connection: default
+lock tables t1 write;
+connection: flush
+flush tables with read lock;;
+connection: default
+alter table t1 add column j int;
+connection: insert
+insert into t1 values (1,2);;
+connection: default
+unlock tables;
+connection: flush
+select * from t1;
+i j
+unlock tables;
+select * from t1;
+i j
+1 2
+drop table t1;
+drop table if exists t1;
+create table t1 (i int);
+connection: default
+lock tables t1 write;
+connection: flush
+flush tables with read lock;;
+connection: default
+flush tables;
+unlock tables;
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result
index b0ec0d25935..8ecfe3b2094 100644
--- a/mysql-test/r/log_state.result
+++ b/mysql-test/r/log_state.result
@@ -237,4 +237,16 @@ SELECT @@slow_query_log, @@log_slow_queries;
1 1
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
+set @old_general_log_file= @@global.general_log_file;
+set @old_slow_query_log_file= @@global.slow_query_log_file;
+set global general_log_file= concat('/not exiting path/log.maste', 'r');
+ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
+set global general_log_file= NULL;
+ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL'
+set global slow_query_log_file= concat('/not exiting path/log.maste', 'r');
+ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exiting path/log.master'
+set global slow_query_log_file= NULL;
+ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL'
+set global general_log_file= @old_general_log_file;
+set global slow_query_log_file= @old_slow_query_log_file;
End of 5.1 tests
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index ba1680f2cac..a709817b7ef 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -927,6 +927,43 @@ CREATE TABLE t2 (c1 INT) ENGINE=MERGE UNION=(t1) INSERT_METHOD=FIRST;
CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
DROP TABLE t1, t2;
+CREATE TABLE t1 (id INT NOT NULL, ref INT NOT NULL, INDEX (id)) ENGINE=MyISAM;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t1 SELECT * FROM t2;
+CREATE TABLE t3 (id INT NOT NULL, ref INT NOT NULL, INDEX (id)) ENGINE=MERGE
+UNION(t1);
+SELECT * FROM t3 AS a INNER JOIN t3 AS b USING (id) WHERE a.ref < b.ref;
+id ref ref
+4 4 5
+4 4 5
+4 4 5
+4 4 5
+SELECT * FROM t3;
+id ref
+1 3
+2 1
+3 2
+4 5
+4 4
+1 3
+2 1
+3 2
+4 5
+4 4
+DELETE FROM a USING t3 AS a INNER JOIN t3 AS b USING (id) WHERE a.ref < b.ref;
+SELECT * FROM t3;
+id ref
+1 3
+2 1
+3 2
+4 5
+1 3
+2 1
+3 2
+4 5
+DROP TABLE t1, t2, t3;
End of 5.0 tests
create table t1 (c1 int, index(c1));
create table t2 (c1 int, index(c1)) engine=merge union=(t1);
diff --git a/mysql-test/r/merge_innodb.result b/mysql-test/r/merge_innodb.result
new file mode 100644
index 00000000000..f6057d279b1
--- /dev/null
+++ b/mysql-test/r/merge_innodb.result
@@ -0,0 +1,37 @@
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+CREATE TABLE t1 (c1 varchar(100)) ENGINE=MyISAM;
+CREATE TABLE t2 (c1 varchar(100)) ENGINE=MyISAM;
+CREATE TABLE t3 (c1 varchar(100)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('Ann'), ('Alice');
+INSERT INTO t2 VALUES ('Bob'), ('Brian');
+INSERT INTO t3 VALUES ('Chris'), ('Charlie');
+CREATE TABLE t4 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t2)
+INSERT_METHOD=LAST;
+CREATE TABLE t5 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t3)
+INSERT_METHOD=LAST;
+SELECT * FROM t5;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM t4;
+c1
+Ann
+Alice
+Bob
+Brian
+ALTER TABLE t2 ENGINE=InnoDB;
+SELECT * FROM t4;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+DELETE FROM t2 LIMIT 1;
+SELECT * FROM t4;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+INSERT INTO t4 VALUES ('Beware');
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM t4;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM t2;
+c1
+Brian
+SELECT * FROM t1;
+c1
+Ann
+Alice
+DROP TABLE t1, t2, t3, t4, t5;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 0bc01e95d2d..d96927deed5 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -627,7 +627,7 @@ a b
4 4
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 268
+master-bin.000001 336
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@@ -637,7 +637,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 283
+master-bin.000001 351
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
drop table if exists t1, t2, t3;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 353d66b1ad5..1c8b5e9d7d9 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1809,6 +1809,28 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
+CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
+INSERT INTO t1 SELECT * FROM t2;
+SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
+id ref ref
+4 4 5
+SELECT * FROM t1;
+id ref
+1 3
+2 1
+3 2
+4 5
+4 4
+DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
+SELECT * FROM t1;
+id ref
+1 3
+2 1
+3 2
+4 5
+DROP TABLE t1, t2;
End of 5.0 tests
create table t1 (a int not null, key `a` (a) key_block_size=1024);
show create table t1;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index e6485720c49..4ffcb7cdeeb 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -23,24 +23,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/;
+drop table if exists t1,t2,t3,t4,t5,t03,t04
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-create table t1 (word varchar(20))/*!*/;
+create table t1 (word varchar(20))
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-create table t2 (id int auto_increment not null primary key)/*!*/;
+create table t2 (id int auto_increment not null primary key)
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-insert into t1 values ("abirvalg")/*!*/;
+insert into t1 values ("abirvalg")
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-insert into t2 values ()/*!*/;
+insert into t2 values ()
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -56,7 +65,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values ("Alas")/*!*/;
+insert into t1 values ("Alas")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -83,7 +93,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values ("Alas")/*!*/;
+insert into t1 values ("Alas")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -100,24 +111,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04/*!*/;
+drop table if exists t1,t2,t3,t4,t5,t03,t04
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-create table t1 (word varchar(20))/*!*/;
+create table t1 (word varchar(20))
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-create table t2 (id int auto_increment not null primary key)/*!*/;
+create table t2 (id int auto_increment not null primary key)
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-insert into t1 values ("abirvalg")/*!*/;
+insert into t1 values ("abirvalg")
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-insert into t2 values ()/*!*/;
+insert into t2 values ()
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -133,7 +153,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values ("Alas")/*!*/;
+insert into t1 values ("Alas")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -160,7 +181,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values ("Alas")/*!*/;
+insert into t1 values ("Alas")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -173,9 +195,11 @@ DELIMITER /*!*/;
ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1108844556/*!*/;
-BEGIN/*!*/;
+BEGIN
+/*!*/;
SET TIMESTAMP=1108844555/*!*/;
-insert t1 values (1)/*!*/;
+insert t1 values (1)
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -185,9 +209,11 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1108844556/*!*/;
-BEGIN/*!*/;
+BEGIN
+/*!*/;
SET TIMESTAMP=1108844555/*!*/;
-insert t1 values (1)/*!*/;
+insert t1 values (1)
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -246,7 +272,8 @@ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.
CREATE DEFINER=`root`@`localhost` procedure p1()
begin
select 1;
-end/*!*/;
+end
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -288,27 +315,36 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a varchar(64) character set utf8)/*!*/;
+create table t1 (a varchar(64) character set utf8)
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r
+/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-drop table t1/*!*/;
+drop table t1
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -352,4 +388,29 @@ a b
1 root@localhost
DROP DATABASE mysqltest1;
DROP USER untrusted@localhost;
+BUG#32580: mysqlbinlog cannot read binlog event with user variables
+USE test;
+SET BINLOG_FORMAT = STATEMENT;
+FLUSH LOGS;
+CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
+SET @a_real = rand(20) * 1000;
+SET @an_int = 1000;
+SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
+SET @a_string = 'Just a test';
+INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
+FLUSH LOGS;
+SELECT * FROM t1;
+a_real 158.883
+an_int 1000
+a_decimal 907.79
+a_string Just a test
+DROP TABLE t1;
+>> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql
+>> mysql test < var/tmp/bug32580.sql
+SELECT * FROM t1;
+a_real 158.883
+an_int 1000
+a_decimal 907.79
+a_string Just a test
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index 5347787d829..0c9ba34fc61 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -29,42 +29,48 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
SET INSERT_ID=1/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
SET INSERT_ID=2/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
SET INSERT_ID=3/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
SET INSERT_ID=4/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar
SET INSERT_ID=5/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
# at {pos}
#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Rotate to master-bin.000002 pos: {pos}
DELIMITER ;
@@ -84,19 +90,24 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -106,6 +117,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
+ROLLBACK/*!*/;
SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
@@ -113,10 +125,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -133,16 +147,20 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -152,6 +170,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
+ROLLBACK/*!*/;
SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
@@ -159,7 +178,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -177,13 +197,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -200,13 +223,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -224,22 +250,28 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -249,7 +281,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -267,19 +300,24 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -289,7 +327,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -299,6 +338,7 @@ ROLLBACK /* added by mysqlbinlog */;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
+ROLLBACK/*!*/;
SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
@@ -306,10 +346,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -319,7 +361,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -336,22 +379,28 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -372,13 +421,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -388,7 +440,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -405,13 +458,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -428,22 +484,28 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -461,19 +523,24 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -490,10 +557,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -510,16 +579,20 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -536,7 +609,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -554,13 +628,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -577,13 +654,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -600,22 +680,28 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -625,7 +711,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -643,19 +730,24 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -665,7 +757,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -682,10 +775,12 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -695,7 +790,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -712,22 +808,28 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -748,13 +850,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
DELIMITER ;
DELIMITER /*!*/;
SET INSERT_ID=6/*!*/;
@@ -764,7 +869,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -781,13 +887,16 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@@ -804,25 +913,32 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))/*!*/;
+create table t1 (a int auto_increment not null primary key, b char(3))
+/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")/*!*/;
+insert into t1 values(null, "a")
+/*!*/;
SET INSERT_ID=2/*!*/;
SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")/*!*/;
+insert into t1 values(null, "b")
+/*!*/;
SET INSERT_ID=3/*!*/;
SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")/*!*/;
+insert into t1 values(null, "c")
+/*!*/;
SET INSERT_ID=4/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")/*!*/;
+insert into t1 values(null, "d")
+/*!*/;
SET INSERT_ID=5/*!*/;
SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")/*!*/;
+insert into t1 values(null, "e")
+/*!*/;
SET INSERT_ID=6/*!*/;
SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")/*!*/;
+insert into t1 values(null, "f")
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index b8ada0adff9..b8fdd04d24a 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -1,4 +1,4 @@
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
mysql.columns_priv OK
@@ -57,4 +57,63 @@ test.t1 OK
test.t1 OK
drop view v1;
drop table t1;
+create table `t``1`(a int);
+create table `t 1`(a int);
+test.t 1 OK
+test.t`1 OK
+drop table `t``1`, `t 1`;
+create database d_bug25347;
+use d_bug25347;
+create table t_bug25347 (a int);
+create view v_bug25347 as select * from t_bug25347;
+insert into t_bug25347 values (1),(2),(3);
+flush tables;
+removing and creating
+d_bug25347.t_bug25347
+Error : Incorrect file format 't_bug25347'
+error : Corrupt
+insert into t_bug25347 values (4),(5),(6);
+ERROR HY000: Incorrect file format 't_bug25347'
+d_bug25347.t_bug25347
+warning : Number of rows changed from 0 to 3
+status : OK
+insert into t_bug25347 values (7),(8),(9);
+select * from t_bug25347;
+a
+1
+2
+3
+7
+8
+9
+select * from v_bug25347;
+a
+1
+2
+3
+7
+8
+9
+drop view v_bug25347;
+drop table t_bug25347;
+drop database d_bug25347;
+use test;
End of 5.0 tests
+create table t1(a int);
+create view v1 as select * from t1;
+show tables;
+Tables_in_test
+t1
+v1
+show tables;
+Tables_in_test
+t1
+#mysql50#v-1
+v1
+show tables;
+Tables_in_test
+t1
+v1
+v-1
+drop view v1, `v-1`;
+drop table t1;
diff --git a/mysql-test/r/mysqlshow.result b/mysql-test/r/mysqlshow.result
index 14d8e4f464b..42081c309d0 100644
--- a/mysql-test/r/mysqlshow.result
+++ b/mysql-test/r/mysqlshow.result
@@ -93,6 +93,7 @@ Database: information_schema
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
+| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
@@ -125,6 +126,7 @@ Database: INFORMATION_SCHEMA
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
+| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result
index 9207dd48d0e..4cb01490407 100644
--- a/mysql-test/r/mysqlslap.result
+++ b/mysql-test/r/mysqlslap.result
@@ -177,13 +177,17 @@ INSERT INTO t1 VALUES (1, 'This is a test');
insert into t2 values ('test', 'test2');
SET AUTOCOMMIT=0;
SHOW TABLES;
+SET AUTOCOMMIT=0;
select * from t1;
+COMMIT;
select * from t2;
COMMIT;
select * from t1;
+COMMIT;
select * from t2;
COMMIT;
select * from t1;
+COMMIT;
select * from t2;
COMMIT;
COMMIT;
@@ -199,13 +203,17 @@ INSERT INTO t1 VALUES (1, 'This is a test');
insert into t2 values ('test', 'test2');
SET AUTOCOMMIT=0;
SHOW TABLES;
+SET AUTOCOMMIT=0;
select * from t1;
+COMMIT;
select * from t2;
COMMIT;
select * from t1;
+COMMIT;
select * from t2;
COMMIT;
select * from t1;
+COMMIT;
select * from t2;
COMMIT;
COMMIT;
diff --git a/mysql-test/r/no-threads.result b/mysql-test/r/no-threads.result
index aefecd0f7bc..9bc2dad6e2a 100644
--- a/mysql-test/r/no-threads.result
+++ b/mysql-test/r/no-threads.result
@@ -7,3 +7,7 @@ select 1+2;
SHOW GLOBAL VARIABLES LIKE 'thread_handling';
Variable_name Value
thread_handling no-threads
+select @@session.thread_handling;
+ERROR HY000: Variable 'thread_handling' is a GLOBAL variable
+set GLOBAL thread_handling='one-thread';
+ERROR HY000: Variable 'thread_handling' is a read only variable
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index 63351d187b6..f2ffe28895d 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -1,5 +1,5 @@
prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
execute stmt1;
ID USER HOST DB COMMAND TIME STATE INFO
-number root localhost test Query time preparing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
+number root localhost test Query time executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
deallocate prepare stmt1;
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index 345c9b07b98..5a2ebc37cc8 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -93,11 +93,9 @@ INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=1/NULL;
-Warnings:
-Warning 1265 Data truncated for column 'd' at row 1
+ERROR 23000: Column 'd' cannot be null
UPDATE t1 SET d=NULL;
-Warnings:
-Warning 1048 Column 'd' cannot be null
+ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
@@ -132,7 +130,7 @@ Warning 1048 Column 'd' cannot be null
Warning 1048 Column 'd' cannot be null
select * from t1;
a b c d
- 0 0000-00-00 00:00:00 0
+ 0 0000-00-00 00:00:00 2003
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result
index 1bcaf308b7c..4a9bdcf412d 100644
--- a/mysql-test/r/outfile_loaddata.result
+++ b/mysql-test/r/outfile_loaddata.result
@@ -82,4 +82,22 @@ c1 c2
-r- =raker=
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
+#
+CREATE TABLE t1 (c1 VARCHAR(256));
+INSERT INTO t1 VALUES (0xC3);
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+C3
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1;
+TRUNCATE t1;
+SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
+HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
+C35CC3C30A
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+C3
+DROP TABLE t1;
# End of 5.0 tests.
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index dfb5595e02d..df0d9ff9adc 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -1,7 +1,15 @@
set global max_allowed_packet=100;
+Warnings:
+Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set max_allowed_packet=100;
+Warnings:
+Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global net_buffer_length=100;
+Warnings:
+Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_buffer_length=100;
+Warnings:
+Warning 1292 Truncated incorrect net_buffer_length value: '100'
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index ef53f227ec0..e10bcba36c2 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -527,3 +527,23 @@ SELECT * FROM t1 WHERE a = INTERVAL(3,2,1) + 1;
a b
3 1998-01-01 00:00:00
DROP TABLE t1;
+DROP TABLE IF EXISTS t1,t2,t3;
+CREATE TABLE t1 (a1 INT, a2 INT, a3 INT, a4 DATETIME);
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+SELECT t1.* FROM t1 AS t0, { OJ t2 INNER JOIN t1 ON (t1.a1=t2.a1) } WHERE t0.a3=2;
+a1 a2 a3 a4
+SELECT t1.*,t2.* FROM { OJ ((t1 INNER JOIN t2 ON (t1.a1=t2.a2)) LEFT OUTER JOIN t3 ON t3.a3=t2.a1)};
+a1 a2 a3 a4 a1 a2 a3 a4
+SELECT t1.*,t2.* FROM { OJ ((t1 LEFT OUTER JOIN t2 ON t1.a3=t2.a2) INNER JOIN t3 ON (t3.a1=t2.a2))};
+a1 a2 a3 a4 a1 a2 a3 a4
+SELECT t1.*,t2.* FROM { OJ (t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a2) CROSS JOIN t3 ON (t3.a2=t2.a3)};
+a1 a2 a3 a4 a1 a2 a3 a4
+SELECT * FROM {oj t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a3} WHERE t1.a2 > 10;
+a1 a2 a3 a4 a1 a2 a3 a4
+SELECT {fn CONCAT(a1,a2)} FROM t1;
+{fn CONCAT(a1,a2)}
+UPDATE t3 SET a4={d '1789-07-14'} WHERE a1=0;
+SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')};
+a1 a4
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 7c25e948d6c..a361a8f6bcc 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1297,6 +1297,19 @@ create table t1
partition by key(s1) partitions 3;
insert into t1 values (null,null);
drop table t1;
+create table t1 (
+c0 int,
+c1 bigint,
+c2 set('sweet'),
+key (c2,c1,c0),
+key(c0)
+) engine=myisam partition by hash (month(c0)) partitions 5;
+insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
+insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
+select c1 from t1 group by (select c0 from t1 limit 1);
+c1
+-6862346
+drop table t1;
CREATE TABLE t1(a int)
PARTITION BY RANGE (a) (
PARTITION p1 VALUES LESS THAN (10),
@@ -1307,4 +1320,101 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
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 'EXTENDED' at line 1
DROP TABLE t1;
+CREATE TABLE t1 (s1 BIGINT UNSIGNED)
+PARTITION BY RANGE (s1) (
+PARTITION p0 VALUES LESS THAN (0),
+PARTITION p1 VALUES LESS THAN (1),
+PARTITION p2 VALUES LESS THAN (18446744073709551615)
+);
+INSERT INTO t1 VALUES (0), (18446744073709551614);
+INSERT INTO t1 VALUES (18446744073709551615);
+ERROR HY000: Table has no partition for value 18446744073709551615
+DROP TABLE t1;
+CREATE TABLE t1 (s1 BIGINT UNSIGNED)
+PARTITION BY RANGE (s1) (
+PARTITION p0 VALUES LESS THAN (0),
+PARTITION p1 VALUES LESS THAN (1),
+PARTITION p2 VALUES LESS THAN (18446744073709551614),
+PARTITION p3 VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (-1), (0), (18446744073709551613),
+(18446744073709551614), (18446744073709551615);
+Warnings:
+Warning 1264 Out of range value for column 's1' at row 1
+SELECT * FROM t1;
+s1
+0
+0
+18446744073709551613
+18446744073709551614
+18446744073709551615
+SELECT * FROM t1 WHERE s1 = 0;
+s1
+0
+0
+SELECT * FROM t1 WHERE s1 = 18446744073709551614;
+s1
+18446744073709551614
+SELECT * FROM t1 WHERE s1 = 18446744073709551615;
+s1
+18446744073709551615
+DROP TABLE t1;
+CREATE TABLE t1 (s1 BIGINT UNSIGNED)
+PARTITION BY RANGE (s1) (
+PARTITION p0 VALUES LESS THAN (0),
+PARTITION p1 VALUES LESS THAN (1),
+PARTITION p2 VALUES LESS THAN (18446744073709551615),
+PARTITION p3 VALUES LESS THAN MAXVALUE
+);
+DROP TABLE t1;
+CREATE TABLE t1
+(int_column INT, char_column CHAR(5),
+PRIMARY KEY(char_column,int_column))
+PARTITION BY KEY(char_column,int_column)
+PARTITIONS 101;
+INSERT INTO t1 (int_column, char_column) VALUES
+( 39868 ,'zZZRW'),
+( 545592 ,'zZzSD'),
+( 4936 ,'zzzsT'),
+( 9274 ,'ZzZSX'),
+( 970185 ,'ZZzTN'),
+( 786036 ,'zZzTO'),
+( 37240 ,'zZzTv'),
+( 313801 ,'zzzUM'),
+( 782427 ,'ZZZva'),
+( 907955 ,'zZZvP'),
+( 453491 ,'zzZWV'),
+( 756594 ,'ZZZXU'),
+( 718061 ,'ZZzZH');
+SELECT * FROM t1 ORDER BY char_column DESC;
+int_column char_column
+718061 ZZzZH
+756594 ZZZXU
+453491 zzZWV
+907955 zZZvP
+782427 ZZZva
+313801 zzzUM
+37240 zZzTv
+786036 zZzTO
+970185 ZZzTN
+9274 ZzZSX
+4936 zzzsT
+545592 zZzSD
+39868 zZZRW
+DROP TABLE t1;
+CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+user CHAR(25), PRIMARY KEY(id))
+PARTITION BY RANGE(id)
+SUBPARTITION BY hash(id) subpartitions 2
+(PARTITION pa1 values less than (10),
+PARTITION pa2 values less than (20),
+PARTITION pa11 values less than MAXVALUE);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `user` char(25) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/partition_archive.result b/mysql-test/r/partition_archive.result
index dd063f6224c..5c84b41e81b 100644
--- a/mysql-test/r/partition_archive.result
+++ b/mysql-test/r/partition_archive.result
@@ -1,4 +1,5 @@
drop database if exists db99;
+drop table if exists t1;
create database db99;
use db99;
create table t1 (a int not null)
@@ -11,3 +12,80 @@ alter table t1 add partition (partition p2 values in (3));
alter table t1 drop partition p2;
use test;
drop database db99;
+create table t1 (f1 integer) engine= ARCHIVE partition by list(f1)
+(
+partition p1 values in (1),
+partition p2 values in (NULL),
+partition p3 values in (2),
+partition p4 values in (3),
+partition p5 values in (4)
+);
+insert into t1 values (1),(2),(3),(4),(null);
+select * from t1;
+f1
+1
+NULL
+2
+3
+4
+select * from t1 where f1 < 3;
+f1
+1
+2
+drop table t1;
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null) engine=ARCHIVE
+partition by hash (a + 2)
+partitions 3
+(partition x1 tablespace ts1,
+partition x2 tablespace ts2,
+partition x3 tablespace ts3);
+insert into t1 values (1,1,1);
+insert into t1 values (2,1,1);
+insert into t1 values (3,1,1);
+insert into t1 values (4,1,1);
+insert into t1 values (5,1,1);
+select * from t1;
+a b c
+1 1 1
+4 1 1
+2 1 1
+5 1 1
+3 1 1
+drop table t1;
+create table t1 (a int) engine=archive partition by hash(a);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) */
+drop table t1;
+CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
+f1 VARCHAR(25),
+PRIMARY KEY(id)) ENGINE=ARCHIVE
+PARTITION BY RANGE(id)
+SUBPARTITION BY hash(id) subpartitions 2
+(PARTITION pa1 values less than (10),
+PARTITION pa2 values less than (20),
+PARTITION pa3 values less than (30),
+PARTITION pa4 values less than (40),
+PARTITION pa5 values less than (50),
+PARTITION pa6 values less than (60),
+PARTITION pa7 values less than (70),
+PARTITION pa8 values less than (80),
+PARTITION pa9 values less than (90),
+PARTITION pa10 values less than (100),
+PARTITION pa11 values less than MAXVALUE);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `f1` varchar(25) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=ARCHIVE AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = ARCHIVE, PARTITION pa2 VALUES LESS THAN (20) ENGINE = ARCHIVE, PARTITION pa3 VALUES LESS THAN (30) ENGINE = ARCHIVE, PARTITION pa4 VALUES LESS THAN (40) ENGINE = ARCHIVE, PARTITION pa5 VALUES LESS THAN (50) ENGINE = ARCHIVE, PARTITION pa6 VALUES LESS THAN (60) ENGINE = ARCHIVE, PARTITION pa7 VALUES LESS THAN (70) ENGINE = ARCHIVE, PARTITION pa8 VALUES LESS THAN (80) ENGINE = ARCHIVE, PARTITION pa9 VALUES LESS THAN (90) ENGINE = ARCHIVE, PARTITION pa10 VALUES LESS THAN (100) ENGINE = ARCHIVE, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) */
+select count(*) from t1;
+count(*)
+100
+drop table t1;
diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result
index 72f036be099..94fefe77a77 100644
--- a/mysql-test/r/partition_hash.result
+++ b/mysql-test/r/partition_hash.result
@@ -1,4 +1,16 @@
drop table if exists t1;
+CREATE TABLE t1 (c1 INT)
+PARTITION BY HASH (c1)
+PARTITIONS 15;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+ALTER TABLE t1 COALESCE PARTITION 13;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT)
+PARTITION BY LINEAR HASH (c1)
+PARTITIONS 5;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+ALTER TABLE t1 COALESCE PARTITION 3;
+DROP TABLE t1;
create table t1 (a int unsigned)
partition by hash(a div 2)
partitions 4;
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index f80e0001ea8..5cbe34c94ca 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,3 +1,15 @@
+# Bug#32948
+CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB;
+CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1),
+FOREIGN KEY (c1) REFERENCES t1 (c1)
+ON DELETE CASCADE)
+ENGINE=INNODB;
+ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+ALTER TABLE t1 ENGINE=MyISAM;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+DROP TABLE t2;
+DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
show table status like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index a61006e87a4..4da79704ec3 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, t2;
create table t1 (a int unsigned)
partition by range (a)
(partition pnull values less than (0),
diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result
new file mode 100644
index 00000000000..a9ada576b4b
--- /dev/null
+++ b/mysql-test/r/profiling.result
@@ -0,0 +1,415 @@
+show profiles;
+Query_ID Duration Query
+show profile all;
+Status Duration CPU_user CPU_system Context_voluntary Context_involuntary Block_ops_in Block_ops_out Messages_sent Messages_received Page_faults_major Page_faults_minor Swaps Source_function Source_file Source_line
+show session variables like 'profil%';
+Variable_name Value
+profiling OFF
+profiling_history_size 15
+select @@profiling;
+@@profiling
+0
+set global profiling = ON;
+ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL
+set global profiling_history_size=100;
+show global variables like 'profil%';
+Variable_name Value
+profiling OFF
+profiling_history_size 100
+set session profiling = ON;
+set session profiling_history_size=30;
+show session variables like 'profil%';
+Variable_name Value
+profiling ON
+profiling_history_size 30
+select @@profiling;
+@@profiling
+1
+create table t1 (
+a int,
+b int
+);
+insert into t1 values (1,1), (2,null), (3, 4);
+insert into t1 values (5,1), (6,null), (7, 4);
+insert into t1 values (1,1), (2,null), (3, 4);
+insert into t1 values (5,1), (6,null), (7, 4);
+select max(x) from (select sum(a) as x from t1 group by b) as teeone;
+max(x)
+20
+insert into t1 select * from t1;
+select count(*) from t1;
+count(*)
+24
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+select count(*) from t1;
+count(*)
+192
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+select count(*) from t1;
+count(*)
+1536
+select sum(a) from t1;
+sum(a)
+6144
+select sum(a) from t1 group by b;
+sum(a)
+2048
+1536
+2560
+select sum(a) + sum(b) from t1 group by b;
+sum(a) + sum(b)
+NULL
+2048
+4608
+select max(x) from (select sum(a) as x from t1 group by b) as teeone;
+max(x)
+2560
+select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string;
+big_string
+012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890
+show profiles;
+Query_ID Duration Query
+1 # set session profiling_history_size=30
+2 # show session variables like 'profil%'
+3 # select @@profiling
+4 # create table t1 (
+a int,
+b int
+)
+5 # insert into t1 values (1,1), (2,null), (3, 4)
+6 # insert into t1 values (5,1), (6,null), (7, 4)
+7 # insert into t1 values (1,1), (2,null), (3, 4)
+8 # insert into t1 values (5,1), (6,null), (7, 4)
+9 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
+10 # insert into t1 select * from t1
+11 # select count(*) from t1
+12 # insert into t1 select * from t1
+13 # insert into t1 select * from t1
+14 # insert into t1 select * from t1
+15 # select count(*) from t1
+16 # insert into t1 select * from t1
+17 # insert into t1 select * from t1
+18 # insert into t1 select * from t1
+19 # select count(*) from t1
+20 # select sum(a) from t1
+21 # select sum(a) from t1 group by b
+22 # select sum(a) + sum(b) from t1 group by b
+23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
+24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
+show profile for query 15;
+show profile cpu for query 15;
+show profile cpu, block io for query 15;
+show profile cpu for query 9 limit 2 offset 2;
+show profile cpu for query 10 limit 0;
+show profile cpu for query 65534;
+show profile memory;
+show profile block io;
+show profile context switches;
+show profile page faults;
+show profile ipc;
+show profile swaps limit 1 offset 2;
+show profile source;
+show profile all for query 0 limit 0;
+show profile all for query 15;
+select * from information_schema.profiling;
+select query_id, state, duration from information_schema.profiling;
+select query_id, sum(duration) from information_schema.profiling group by query_id;
+select query_id, count(*) from information_schema.profiling group by query_id;
+select sum(duration) from information_schema.profiling;
+select query_id, count(*), sum(duration) from information_schema.profiling group by query_id;
+select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling;
+drop table if exists t1, t2, t3;
+Warnings:
+Note 1051 Unknown table 't2'
+Note 1051 Unknown table 't3'
+create table t1 (id int );
+create table t2 (id int not null);
+create table t3 (id int not null primary key);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1), (2), (3);
+insert into t3 values (1), (2), (3);
+show profiles;
+Query_ID Duration Query
+10 # insert into t1 select * from t1
+11 # select count(*) from t1
+12 # insert into t1 select * from t1
+13 # insert into t1 select * from t1
+14 # insert into t1 select * from t1
+15 # select count(*) from t1
+16 # insert into t1 select * from t1
+17 # insert into t1 select * from t1
+18 # insert into t1 select * from t1
+19 # select count(*) from t1
+20 # select sum(a) from t1
+21 # select sum(a) from t1 group by b
+22 # select sum(a) + sum(b) from t1 group by b
+23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
+24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
+25 # select * from information_schema.profiling
+26 # select query_id, state, duration from information_schema.profiling
+27 # select query_id, sum(duration) from information_schema.profiling group by query_id
+28 # select query_id, count(*) from information_schema.profiling group by query_id
+29 # select sum(duration) from information_schema.profiling
+30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
+31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
+32 # drop table if exists t1, t2, t3
+33 # SHOW WARNINGS
+34 # create table t1 (id int )
+35 # create table t2 (id int not null)
+36 # create table t3 (id int not null primary key)
+37 # insert into t1 values (1), (2), (3)
+38 # insert into t2 values (1), (2), (3)
+39 # insert into t3 values (1), (2), (3)
+select * from t1;
+id
+1
+2
+3
+show profiles;
+Query_ID Duration Query
+11 # select count(*) from t1
+12 # insert into t1 select * from t1
+13 # insert into t1 select * from t1
+14 # insert into t1 select * from t1
+15 # select count(*) from t1
+16 # insert into t1 select * from t1
+17 # insert into t1 select * from t1
+18 # insert into t1 select * from t1
+19 # select count(*) from t1
+20 # select sum(a) from t1
+21 # select sum(a) from t1 group by b
+22 # select sum(a) + sum(b) from t1 group by b
+23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
+24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
+25 # select * from information_schema.profiling
+26 # select query_id, state, duration from information_schema.profiling
+27 # select query_id, sum(duration) from information_schema.profiling group by query_id
+28 # select query_id, count(*) from information_schema.profiling group by query_id
+29 # select sum(duration) from information_schema.profiling
+30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
+31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
+32 # drop table if exists t1, t2, t3
+33 # SHOW WARNINGS
+34 # create table t1 (id int )
+35 # create table t2 (id int not null)
+36 # create table t3 (id int not null primary key)
+37 # insert into t1 values (1), (2), (3)
+38 # insert into t2 values (1), (2), (3)
+39 # insert into t3 values (1), (2), (3)
+40 # select * from t1
+This ^^ should end in "select * from t1;"
+delete from t1;
+insert into t1 values (1), (2), (3);
+insert into t1 values (1), (2), (3);
+select * from t1;
+id
+1
+2
+3
+1
+2
+3
+show profiles;
+Query_ID Duration Query
+15 # select count(*) from t1
+16 # insert into t1 select * from t1
+17 # insert into t1 select * from t1
+18 # insert into t1 select * from t1
+19 # select count(*) from t1
+20 # select sum(a) from t1
+21 # select sum(a) from t1 group by b
+22 # select sum(a) + sum(b) from t1 group by b
+23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
+24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
+25 # select * from information_schema.profiling
+26 # select query_id, state, duration from information_schema.profiling
+27 # select query_id, sum(duration) from information_schema.profiling group by query_id
+28 # select query_id, count(*) from information_schema.profiling group by query_id
+29 # select sum(duration) from information_schema.profiling
+30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
+31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
+32 # drop table if exists t1, t2, t3
+33 # SHOW WARNINGS
+34 # create table t1 (id int )
+35 # create table t2 (id int not null)
+36 # create table t3 (id int not null primary key)
+37 # insert into t1 values (1), (2), (3)
+38 # insert into t2 values (1), (2), (3)
+39 # insert into t3 values (1), (2), (3)
+40 # select * from t1
+41 # delete from t1
+42 # insert into t1 values (1), (2), (3)
+43 # insert into t1 values (1), (2), (3)
+44 # select * from t1
+set session profiling = OFF;
+select sum(id) from t1;
+sum(id)
+12
+show profiles;
+Query_ID Duration Query
+15 # select count(*) from t1
+16 # insert into t1 select * from t1
+17 # insert into t1 select * from t1
+18 # insert into t1 select * from t1
+19 # select count(*) from t1
+20 # select sum(a) from t1
+21 # select sum(a) from t1 group by b
+22 # select sum(a) + sum(b) from t1 group by b
+23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
+24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
+25 # select * from information_schema.profiling
+26 # select query_id, state, duration from information_schema.profiling
+27 # select query_id, sum(duration) from information_schema.profiling group by query_id
+28 # select query_id, count(*) from information_schema.profiling group by query_id
+29 # select sum(duration) from information_schema.profiling
+30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
+31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
+32 # drop table if exists t1, t2, t3
+33 # SHOW WARNINGS
+34 # create table t1 (id int )
+35 # create table t2 (id int not null)
+36 # create table t3 (id int not null primary key)
+37 # insert into t1 values (1), (2), (3)
+38 # insert into t2 values (1), (2), (3)
+39 # insert into t3 values (1), (2), (3)
+40 # select * from t1
+41 # delete from t1
+42 # insert into t1 values (1), (2), (3)
+43 # insert into t1 values (1), (2), (3)
+44 # select * from t1
+set session profiling = ON;
+select @@profiling;
+@@profiling
+1
+create function f1() returns varchar(50) return 'hello';
+select @@profiling;
+@@profiling
+1
+select * from t1 where id <> f1();
+id
+1
+2
+3
+1
+2
+3
+select @@profiling;
+@@profiling
+1
+set session profiling = OFF;
+drop table if exists profile_log;
+Warnings:
+Note 1051 Unknown table 'profile_log'
+create table profile_log (how_many int);
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop procedure if exists p3;
+create procedure p1 ()
+modifies sql data
+begin
+set profiling = ON;
+select 'This p1 should show up in profiling';
+insert into profile_log select count(*) from information_schema.profiling;
+end//
+create procedure p2()
+deterministic
+begin
+set profiling = ON;
+call p1();
+select 'This p2 should show up in profiling';
+end//
+create procedure p3 ()
+reads sql data
+begin
+set profiling = ON;
+select 'This p3 should show up in profiling';
+show profile;
+end//
+first call to p1
+call p1;
+select * from profile_log;
+second call to p1
+call p1;
+select * from profile_log;
+third call to p1
+call p1;
+select * from profile_log;
+set session profiling = OFF;
+call p2;
+set session profiling = OFF;
+call p3;
+show profiles;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop procedure if exists p3;
+drop table if exists profile_log;
+set session profiling = ON;
+drop table if exists t2;
+create table t2 (id int not null);
+create trigger t2_bi before insert on t2 for each row set @x=0;
+select @@profiling;
+@@profiling
+1
+insert into t2 values (1), (2), (3);
+select @@profiling;
+@@profiling
+1
+set session profiling = ON;
+drop table if exists t1, t2;
+create table t1 (id int not null primary key);
+create table t2 (id int not null primary key, id1 int not null);
+select @@profiling;
+@@profiling
+1
+alter table t2 add foreign key (id1) references t1 (id) on delete cascade;
+select @@profiling;
+@@profiling
+1
+lock table t1 write;
+select @@profiling;
+@@profiling
+1
+unlock table;
+select @@profiling;
+@@profiling
+1
+set autocommit=0;
+select @@profiling, @@autocommit;
+@@profiling @@autocommit
+1 0
+begin;
+select @@profiling;
+@@profiling
+1
+insert into t1 values (1);
+insert into t2 values (1,1);
+testing referential integrity cascade
+delete from t1 where id = 1;
+select @@profiling;
+@@profiling
+1
+testing rollback
+rollback;
+select @@profiling;
+@@profiling
+1
+testing commit
+begin;
+select @@profiling;
+@@profiling
+1
+commit;
+select @@profiling;
+@@profiling
+1
+drop table if exists t1, t2, t3;
+drop view if exists v1;
+Warnings:
+Note 1051 Unknown table 'test.v1'
+drop function if exists f1;
+set session profiling = OFF;
+End of 5.0 tests
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 9d0906ad5e7..a6b07bfc127 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -807,6 +807,8 @@ select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
0
set global max_prepared_stmt_count=10000000000000000;
+Warnings:
+Warning 1292 Truncated incorrect max_prepared_stmt_count value: '10000000000000000'
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1048576
@@ -1143,6 +1145,11 @@ a
13
DEALLOCATE PREPARE st1;
DROP TABLE t1;
+create table t1 (a int, b tinyint);
+prepare st1 from 'update t1 set b= (str_to_date(a, a))';
+execute st1;
+deallocate prepare st1;
+drop table t1;
End of 4.1 tests.
create table t1 (a varchar(20));
insert into t1 values ('foo');
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index eb8ef7a85c3..06bfd78a351 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -783,20 +783,20 @@ a b
2 two
3 three
4 four
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
@@ -1303,12 +1303,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 15650efa41d..f56b1d37a2c 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -783,20 +783,20 @@ a b
2 two
3 three
4 four
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
@@ -1286,12 +1286,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 486f770220e..0c643facf72 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -784,20 +784,20 @@ a b
2 two
3 three
4 four
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
@@ -1287,12 +1287,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 0229b0ece08..bd3cd4ac1fc 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -826,20 +826,20 @@ a b
2 two
3 three
4 four
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
@@ -1329,12 +1329,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
@@ -3848,20 +3847,20 @@ a b
2 two
3 three
4 four
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
deallocate prepare stmt1 ;
-prepare stmt1 from ' SELECT a as ccc from t1 where a+1=
- (SELECT 1+ccc from t1 where ccc+1=a+1 and a=1) ';
+prepare stmt1 from ' SELECT a as ccc from t1 outr where a+1=
+ (SELECT 1+outr.a from t1 where outr.a+1=a+1 and a=1) ';
execute stmt1 ;
ccc
1
@@ -4351,12 +4350,11 @@ a b
set @arg00=NULL;
set @arg01=2;
execute stmt1 using @arg00, @arg01;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
select a,b from t1 order by a;
a b
-0 two
1 one
+2 two
3 three
4 four
set @arg00=0;
diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result
new file mode 100644
index 00000000000..0987e765265
--- /dev/null
+++ b/mysql-test/r/ps_ddl.result
@@ -0,0 +1,2329 @@
+=====================================================================
+Testing 1: NOTHING -> TABLE transitions
+=====================================================================
+drop table if exists t1;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+prepare stmt from 'select * from t1';
+ERROR 42S02: Table 'test.t1' doesn't exist
+=====================================================================
+Testing 2: NOTHING -> TEMPORARY TABLE transitions
+=====================================================================
+=====================================================================
+Testing 3: NOTHING -> VIEW transitions
+=====================================================================
+=====================================================================
+Testing 4: TABLE -> NOTHING transitions
+=====================================================================
+drop table if exists t4;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t4(a int);
+prepare stmt from 'select * from t4';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t4;
+execute stmt;
+ERROR 42S02: Table 'test.t4' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42S02: Table 'test.t4' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+=====================================================================
+Testing 5: TABLE -> TABLE (DDL) transitions
+=====================================================================
+drop table if exists t5;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t5(a int);
+prepare stmt from 'select * from t5';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t5 add column (b int);
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t5;
+=====================================================================
+Testing 6: TABLE -> TABLE (TRIGGER) transitions
+=====================================================================
+drop table if exists t6;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t6(a int);
+prepare stmt from 'insert into t6(a) value (?)';
+set @val=1;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+set @val=2;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+create trigger t6_bi before insert on t6 for each row
+begin
+set @message= "t6_bi";
+end
+$$
+set @message="none";
+set @val=3;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+set @val=4;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+prepare stmt from 'insert into t6(a) value (?)';
+set @message="none";
+set @val=5;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+set @message="none";
+set @val=6;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+create trigger t6_bd before delete on t6 for each row
+begin
+set @message= "t6_bd";
+end
+$$
+set @message="none";
+set @val=7;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+set @message="none";
+set @val=8;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+prepare stmt from 'insert into t6(a) value (?)';
+set @message="none";
+set @val=9;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+set @message="none";
+set @val=10;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select @message;
+@message
+t6_bi
+drop trigger t6_bi;
+create trigger t6_bi before insert on t6 for each row
+begin
+set @message= "t6_bi (2)";
+end
+$$
+set @message="none";
+set @val=11;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+set @val=12;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+prepare stmt from 'insert into t6(a) value (?)';
+set @message="none";
+set @val=13;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+set @message="none";
+set @val=14;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+drop trigger t6_bd;
+create trigger t6_bd before delete on t6 for each row
+begin
+set @message= "t6_bd (2)";
+end
+$$
+set @message="none";
+set @val=15;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+set @message="none";
+set @val=16;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+prepare stmt from 'insert into t6(a) value (?)';
+set @message="none";
+set @val=17;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+set @message="none";
+set @val=18;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+t6_bi (2)
+drop trigger t6_bi;
+set @message="none";
+set @val=19;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+none
+set @val=20;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+none
+prepare stmt from 'insert into t6(a) value (?)';
+set @message="none";
+set @val=21;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+none
+set @val=22;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+none
+drop trigger t6_bd;
+set @val=23;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+none
+set @val=24;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+select @message;
+@message
+none
+select * from t6 order by a;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+drop table t6;
+=====================================================================
+Testing 7: TABLE -> TABLE (TRIGGER dependencies) transitions
+=====================================================================
+drop table if exists t7_proc;
+drop table if exists t7_func;
+drop table if exists t7_view;
+drop table if exists t7_table;
+drop table if exists t7_dependent_table;
+drop table if exists t7_table_trigger;
+drop table if exists t7_audit;
+drop procedure if exists audit_proc;
+drop function if exists audit_func;
+drop view if exists audit_view;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t7_proc(a int);
+create table t7_func(a int);
+create table t7_view(a int);
+create table t7_table(a int);
+create table t7_table_trigger(a int);
+create table t7_audit(old_a int, new_a int, reason varchar(50));
+create table t7_dependent_table(old_a int, new_a int, reason varchar(50));
+create procedure audit_proc(a int)
+insert into t7_audit values (NULL, a, "proc v1");
+create function audit_func() returns varchar(50)
+return "func v1";
+create view audit_view as select "view v1" as reason from dual;
+create trigger t7_proc_bi before insert on t7_proc for each row
+call audit_proc(NEW.a);
+create trigger t7_func_bi before insert on t7_func for each row
+insert into t7_audit values (NULL, NEW.a, audit_func());
+create trigger t7_view_bi before insert on t7_view for each row
+insert into t7_audit values (NULL, NEW.a, (select reason from audit_view));
+create trigger t7_table_bi before insert on t7_table for each row
+insert into t7_dependent_table values (NULL, NEW.a, "dependent table");
+create trigger t7_table_trigger_bi before insert on t7_dependent_table
+for each row set NEW.reason="trigger v1";
+prepare stmt_proc from 'insert into t7_proc(a) value (?)';
+set @val=101;
+execute stmt_proc using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+set @val=102;
+execute stmt_proc using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure audit_proc;
+create procedure audit_proc(a int)
+insert into t7_audit values (NULL, a, "proc v2");
+set @val=103;
+execute stmt_proc using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+set @val=104;
+execute stmt_proc using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+prepare stmt_func from 'insert into t7_func(a) value (?)';
+set @val=201;
+execute stmt_func using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+set @val=202;
+execute stmt_func using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function audit_func;
+create function audit_func() returns varchar(50)
+return "func v2";
+set @val=203;
+execute stmt_func using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+set @val=204;
+execute stmt_func using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+prepare stmt_view from 'insert into t7_view(a) value (?)';
+set @val=301;
+execute stmt_view using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+set @val=302;
+execute stmt_view using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view audit_view;
+create view audit_view as select "view v2" as reason from dual;
+set @val=303;
+execute stmt_view using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+set @val=304;
+execute stmt_view using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+prepare stmt_table from 'insert into t7_table(a) value (?)';
+set @val=401;
+execute stmt_table using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+set @val=402;
+execute stmt_table using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+alter table t7_dependent_table add column comments varchar(100) default NULL;
+set @val=403;
+execute stmt_table using @val;
+ERROR 21S01: Column count doesn't match value count at row 1
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+set @val=404;
+execute stmt_table using @val;
+ERROR 21S01: Column count doesn't match value count at row 1
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+alter table t7_dependent_table drop column comments;
+set @val=405;
+execute stmt_table using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+set @val=406;
+execute stmt_table using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+prepare stmt_table_trigger from 'insert into t7_table(a) value (?)';
+set @val=501;
+execute stmt_table_trigger using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+set @val=502;
+execute stmt_table_trigger using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+drop trigger t7_table_trigger_bi;
+create trigger t7_table_trigger_bi before insert on t7_dependent_table
+for each row set NEW.reason="trigger v2";
+set @val=503;
+execute stmt_table_trigger using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+4
+set @val=504;
+execute stmt_table_trigger using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+4
+select * from t7_audit order by new_a;
+old_a new_a reason
+NULL 101 proc v1
+NULL 102 proc v1
+NULL 103 proc v2
+NULL 104 proc v2
+NULL 201 func v1
+NULL 202 func v1
+NULL 203 func v2
+NULL 204 func v2
+NULL 301 view v1
+NULL 302 view v1
+NULL 303 view v1
+NULL 304 view v1
+select * from t7_dependent_table order by new_a;
+old_a new_a reason
+NULL 401 trigger v1
+NULL 402 trigger v1
+NULL 405 trigger v1
+NULL 406 trigger v1
+NULL 501 trigger v1
+NULL 502 trigger v1
+NULL 503 trigger v2
+NULL 504 trigger v2
+drop table t7_proc;
+drop table t7_func;
+drop table t7_view;
+drop table t7_table;
+drop table t7_dependent_table;
+drop table t7_table_trigger;
+drop table t7_audit;
+drop procedure audit_proc;
+drop function audit_func;
+drop view audit_view;
+=====================================================================
+Testing 8: TABLE -> TEMPORARY TABLE transitions
+=====================================================================
+drop table if exists t8;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t8(a int);
+prepare stmt from 'select * from t8';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t8;
+create temporary table t8(a int);
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t8;
+=====================================================================
+Testing 9: TABLE -> VIEW transitions
+=====================================================================
+drop table if exists t9;
+drop table if exists t9_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t9(a int);
+create table t9_b(a int);
+prepare stmt from 'select * from t9';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t9;
+create view t9 as select * from t9_b;
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop view t9;
+drop table t9_b;
+=====================================================================
+Testing 10: TEMPORARY TABLE -> NOTHING transitions
+=====================================================================
+drop temporary table if exists t10;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create temporary table t10(a int);
+prepare stmt from 'select * from t10';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop temporary table t10;
+execute stmt;
+ERROR 42S02: Table 'test.t10' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42S02: Table 'test.t10' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+=====================================================================
+Testing 11: TEMPORARY TABLE -> TABLE transitions
+=====================================================================
+drop table if exists t11;
+drop temporary table if exists t11;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t11(a int);
+insert into t11(a) value (1);
+create temporary table t11(a int);
+prepare stmt from 'select * from t11';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop temporary table t11;
+execute stmt;
+a
+1
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+1
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select * from t11;
+a
+1
+drop table t11;
+=====================================================================
+Testing 12: TEMPORARY TABLE -> TEMPORARY TABLE (DDL) transitions
+=====================================================================
+drop temporary table if exists t12;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create temporary table t12(a int);
+prepare stmt from 'select * from t12';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop temporary table t12;
+create temporary table t12(a int, b int);
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+select * from t12;
+a b
+drop table t12;
+=====================================================================
+Testing 13: TEMPORARY TABLE -> VIEW transitions
+=====================================================================
+drop temporary table if exists t13;
+drop table if exists t13_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create temporary table t13(a int);
+create table t13_b(a int);
+prepare stmt from 'select * from t13';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop temporary table t13;
+create view t13 as select * from t13_b;
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop view t13;
+drop table t13_b;
+=====================================================================
+Testing 14: VIEW -> NOTHING transitions
+=====================================================================
+drop view if exists t14;
+drop table if exists t14_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t14_b(a int);
+create view t14 as select * from t14_b;
+prepare stmt from 'select * from t14';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view t14;
+execute stmt;
+ERROR 42S02: Table 'test.t14' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+ERROR 42S02: Table 'test.t14' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t14_b;
+=====================================================================
+Testing 15: VIEW -> TABLE transitions
+=====================================================================
+drop view if exists t15;
+drop table if exists t15_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t15_b(a int);
+create view t15 as select * from t15_b;
+prepare stmt from 'select * from t15';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view t15;
+create table t15(a int);
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t15_b;
+drop table t15;
+=====================================================================
+Testing 16: VIEW -> TEMPORARY TABLE transitions
+=====================================================================
+drop view if exists t16;
+drop table if exists t16_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t16_b(a int);
+create view t16 as select * from t16_b;
+prepare stmt from 'select * from t16';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view t16;
+create temporary table t16(a int);
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t16_b;
+drop temporary table t16;
+=====================================================================
+Testing 17: VIEW -> VIEW (DDL) transitions
+=====================================================================
+drop view if exists t17;
+drop table if exists t17_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t17_b(a int);
+insert into t17_b values (10), (20), (30);
+create view t17 as select a, 2*a as b, 3*a as c from t17_b;
+select * from t17;
+a b c
+10 20 30
+20 40 60
+30 60 90
+prepare stmt from 'select * from t17';
+execute stmt;
+a b c
+10 20 30
+20 40 60
+30 60 90
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a b c
+10 20 30
+20 40 60
+30 60 90
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view t17;
+create view t17 as select a, 2*a as b, 10*a as c from t17_b;
+select * from t17;
+a b c
+10 20 100
+20 40 200
+30 60 300
+execute stmt;
+a b c
+10 20 100
+20 40 200
+30 60 300
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a b c
+10 20 100
+20 40 200
+30 60 300
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t17_b;
+drop view t17;
+=====================================================================
+Testing 18: VIEW -> VIEW (VIEW dependencies) transitions
+=====================================================================
+drop table if exists t18;
+drop table if exists t18_dependent_table;
+drop view if exists t18_func;
+drop view if exists t18_view;
+drop view if exists t18_table;
+drop function if exists view_func;
+drop view if exists view_view;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t18(a int);
+insert into t18 values (1), (2), (3);
+create function view_func(x int) returns int
+return x+1;
+create view view_view as select "view v1" as reason from dual;
+create table t18_dependent_table(a int);
+create view t18_func as select a, view_func(a) as b from t18;
+create view t18_view as select a, reason as b from t18, view_view;
+create view t18_table as select * from t18;
+prepare stmt_func from 'select * from t18_func';
+execute stmt_func;
+a b
+1 2
+2 3
+3 4
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_func;
+a b
+1 2
+2 3
+3 4
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function view_func;
+create function view_func(x int) returns int
+return x*x;
+execute stmt_func;
+a b
+1 1
+2 4
+3 9
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_func;
+a b
+1 1
+2 4
+3 9
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+prepare stmt_view from 'select * from t18_view';
+execute stmt_view;
+a b
+1 view v1
+2 view v1
+3 view v1
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_view;
+a b
+1 view v1
+2 view v1
+3 view v1
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view view_view;
+create view view_view as select "view v2" as reason from dual;
+execute stmt_view;
+a b
+1 view v2
+2 view v2
+3 view v2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt_view;
+a b
+1 view v2
+2 view v2
+3 view v2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+prepare stmt_table from 'select * from t18_table';
+execute stmt_table;
+a
+1
+2
+3
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt_table;
+a
+1
+2
+3
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+alter table t18 add column comments varchar(50) default NULL;
+execute stmt_table;
+a
+1
+2
+3
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+execute stmt_table;
+a
+1
+2
+3
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+drop table t18;
+drop table t18_dependent_table;
+drop view t18_func;
+drop view t18_view;
+drop view t18_table;
+drop function view_func;
+drop view view_view;
+=====================================================================
+Testing 19: Special tables (INFORMATION_SCHEMA)
+=====================================================================
+drop procedure if exists proc_19;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+prepare stmt from
+'select ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE
+ from INFORMATION_SCHEMA.ROUTINES where
+ routine_name=\'proc_19\'';
+create procedure proc_19() select "hi there";
+execute stmt;
+ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE
+test proc_19 PROCEDURE
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE
+test proc_19 PROCEDURE
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure proc_19;
+create procedure proc_19() select "hi there, again";
+execute stmt;
+ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE
+test proc_19 PROCEDURE
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE
+test proc_19 PROCEDURE
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure proc_19;
+=====================================================================
+Testing 20: Special tables (log tables)
+=====================================================================
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+prepare stmt from
+'select * from mysql.general_log where argument=\'IMPOSSIBLE QUERY STRING\'';
+execute stmt;
+event_time user_host thread_id server_id command_type argument
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+event_time user_host thread_id server_id command_type argument
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+event_time user_host thread_id server_id command_type argument
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+event_time user_host thread_id server_id command_type argument
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+=====================================================================
+Testing 21: Special tables (system tables)
+=====================================================================
+drop procedure if exists proc_21;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+prepare stmt from
+'select type, db, name from mysql.proc where name=\'proc_21\'';
+create procedure proc_21() select "hi there";
+execute stmt;
+type db name
+PROCEDURE test proc_21
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+type db name
+PROCEDURE test proc_21
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure proc_21;
+create procedure proc_21() select "hi there, again";
+execute stmt;
+type db name
+PROCEDURE test proc_21
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+type db name
+PROCEDURE test proc_21
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure proc_21;
+=====================================================================
+Testing 22: Special tables (views temp tables)
+=====================================================================
+drop table if exists t22_b;
+drop view if exists t22;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t22_b(a int);
+create algorithm=temptable view t22 as select a*a as a2 from t22_b;
+show create view t22;
+View Create View character_set_client collation_connection
+t22 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t22` AS select (`t22_b`.`a` * `t22_b`.`a`) AS `a2` from `t22_b` latin1 latin1_swedish_ci
+prepare stmt from 'select * from t22';
+insert into t22_b values (1), (2), (3);
+execute stmt;
+a2
+1
+4
+9
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a2
+1
+4
+9
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+insert into t22_b values (4), (5), (6);
+execute stmt;
+a2
+1
+4
+9
+16
+25
+36
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a2
+1
+4
+9
+16
+25
+36
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t22_b;
+drop view t22;
+=====================================================================
+Testing 23: Special tables (internal join tables)
+=====================================================================
+drop table if exists t23_a;
+drop table if exists t23_b;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t23_a(a int);
+create table t23_b(b int);
+prepare stmt from 'select * from t23_a join t23_b';
+insert into t23_a values (1), (2), (3);
+insert into t23_b values (10), (20), (30);
+execute stmt;
+a b
+1 10
+2 10
+3 10
+1 20
+2 20
+3 20
+1 30
+2 30
+3 30
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a b
+1 10
+2 10
+3 10
+1 20
+2 20
+3 20
+1 30
+2 30
+3 30
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+insert into t23_a values (4);
+insert into t23_b values (40);
+execute stmt;
+a b
+1 10
+2 10
+3 10
+4 10
+1 20
+2 20
+3 20
+4 20
+1 30
+2 30
+3 30
+4 30
+1 40
+2 40
+3 40
+4 40
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a b
+1 10
+2 10
+3 10
+4 10
+1 20
+2 20
+3 20
+4 20
+1 30
+2 30
+3 30
+4 30
+1 40
+2 40
+3 40
+4 40
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t23_a;
+drop table t23_b;
+=====================================================================
+Testing 24: Special statements
+=====================================================================
+drop table if exists t24_alter;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t24_alter(a int);
+prepare stmt from 'alter table t24_alter add column b int';
+execute stmt;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_alter;
+create table t24_alter(a1 int, a2 int);
+execute stmt;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_alter drop column b;
+execute stmt;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_alter drop column b;
+execute stmt;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_alter;
+drop table if exists t24_repair;
+create table t24_repair(a int);
+insert into t24_repair values (1), (2), (3);
+prepare stmt from 'repair table t24_repair';
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_repair repair status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_repair;
+create table t24_repair(a1 int, a2 int);
+insert into t24_repair values (1, 10), (2, 20), (3, 30);
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_repair repair status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_repair add column b varchar(50) default NULL;
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_repair repair status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_repair drop column b;
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_repair repair status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_repair;
+drop table if exists t24_analyze;
+create table t24_analyze(a int);
+insert into t24_analyze values (1), (2), (3);
+prepare stmt from 'analyze table t24_analyze';
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_analyze analyze status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_analyze;
+create table t24_analyze(a1 int, a2 int);
+insert into t24_analyze values (1, 10), (2, 20), (3, 30);
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_analyze analyze status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_analyze add column b varchar(50) default NULL;
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_analyze analyze status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_analyze drop column b;
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_analyze analyze status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_analyze;
+drop table if exists t24_optimize;
+create table t24_optimize(a int);
+insert into t24_optimize values (1), (2), (3);
+prepare stmt from 'optimize table t24_optimize';
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_optimize optimize status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_optimize;
+create table t24_optimize(a1 int, a2 int);
+insert into t24_optimize values (1, 10), (2, 20), (3, 30);
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_optimize optimize status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_optimize add column b varchar(50) default NULL;
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_optimize optimize status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t24_optimize drop column b;
+execute stmt;
+Table Op Msg_type Msg_text
+test.t24_optimize optimize status OK
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_optimize;
+drop procedure if exists changing_proc;
+prepare stmt from 'show create procedure changing_proc';
+execute stmt;
+ERROR 42000: PROCEDURE changing_proc does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42000: PROCEDURE changing_proc does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+create procedure changing_proc() begin end;
+execute stmt;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`()
+begin end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`()
+begin end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure changing_proc;
+create procedure changing_proc(x int, y int) begin end;
+execute stmt;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`(x int, y int)
+begin end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`(x int, y int)
+begin end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop procedure changing_proc;
+execute stmt;
+ERROR 42000: PROCEDURE changing_proc does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42000: PROCEDURE changing_proc does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function if exists changing_func;
+prepare stmt from 'show create function changing_func';
+execute stmt;
+ERROR 42000: FUNCTION changing_func does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42000: FUNCTION changing_func does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+create function changing_func() returns int return 0;
+execute stmt;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`() RETURNS int(11)
+return 0 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`() RETURNS int(11)
+return 0 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function changing_func;
+create function changing_func(x int, y int) returns int return x+y;
+execute stmt;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`(x int, y int) RETURNS int(11)
+return x+y latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`(x int, y int) RETURNS int(11)
+return x+y latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function changing_func;
+execute stmt;
+ERROR 42000: FUNCTION changing_func does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42000: FUNCTION changing_func does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table if exists t24_trigger;
+create table t24_trigger(a int);
+prepare stmt from 'show create trigger t24_bi;';
+execute stmt;
+ERROR HY000: Trigger does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR HY000: Trigger does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+create trigger t24_bi before insert on t24_trigger for each row
+begin
+set @message= "t24_bi";
+end
+$$
+execute stmt;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row
+begin
+set @message= "t24_bi";
+end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row
+begin
+set @message= "t24_bi";
+end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop trigger t24_bi;
+create trigger t24_bi before insert on t24_trigger for each row
+begin
+set @message= "t24_bi (2)";
+end
+$$
+execute stmt;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row
+begin
+set @message= "t24_bi (2)";
+end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row
+begin
+set @message= "t24_bi (2)";
+end latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop trigger t24_bi;
+execute stmt;
+ERROR HY000: Trigger does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR HY000: Trigger does not exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t24_trigger;
+=====================================================================
+Testing 25: Testing the strength of TABLE_SHARE version
+=====================================================================
+drop table if exists t25_num_col;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t25_num_col(a int);
+prepare stmt from 'select * from t25_num_col';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+alter table t25_num_col add column b varchar(50) default NULL;
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table t25_num_col;
+drop table if exists t25_col_name;
+create table t25_col_name(a int);
+prepare stmt from 'select * from t25_col_name';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+alter table t25_col_name change a b int;
+execute stmt;
+b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+execute stmt;
+b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+drop table t25_col_name;
+drop table if exists t25_col_type;
+create table t25_col_type(a int);
+prepare stmt from 'select * from t25_col_type';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+alter table t25_col_type change a a varchar(10);
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+drop table t25_col_type;
+drop table if exists t25_col_type_length;
+create table t25_col_type_length(a varchar(10));
+prepare stmt from 'select * from t25_col_type_length';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+3
+alter table t25_col_type_length change a a varchar(20);
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+4
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+4
+drop table t25_col_type_length;
+drop table if exists t25_col_null;
+create table t25_col_null(a varchar(10));
+prepare stmt from 'select * from t25_col_null';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+4
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+4
+alter table t25_col_null change a a varchar(10) NOT NULL;
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+drop table t25_col_null;
+drop table if exists t25_col_default;
+create table t25_col_default(a int, b int DEFAULT 10);
+prepare stmt from 'insert into t25_col_default(a) values (?)';
+set @val=1;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+set @val=2;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+alter table t25_col_default change b b int DEFAULT 20;
+set @val=3;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+set @val=4;
+execute stmt using @val;
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+select * from t25_col_default;
+a b
+1 10
+2 10
+3 20
+4 20
+drop table t25_col_default;
+drop table if exists t25_index;
+create table t25_index(a varchar(10));
+prepare stmt from 'select * from t25_index';
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+5
+create index i1 on t25_index(a);
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+6
+execute stmt;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+6
+drop table t25_index;
+drop table if exists t25_index_unique;
+create table t25_index_unique(a varchar(10), b varchar(10));
+create index i1 on t25_index_unique(a, b);
+show create table t25_index_unique;
+Table Create Table
+t25_index_unique CREATE TABLE `t25_index_unique` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ KEY `i1` (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+prepare stmt from 'select * from t25_index_unique';
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+6
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+6
+alter table t25_index_unique drop index i1;
+create unique index i1 on t25_index_unique(a, b);
+show create table t25_index_unique;
+Table Create Table
+t25_index_unique CREATE TABLE `t25_index_unique` (
+ `a` varchar(10) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL,
+ UNIQUE KEY `i1` (`a`,`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+7
+execute stmt;
+a b
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+7
+drop table t25_index_unique;
+=====================================================================
+Testing reported bugs
+=====================================================================
+drop table if exists table_12093;
+drop function if exists func_12093;
+drop function if exists func_12093_unrelated;
+drop procedure if exists proc_12093;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table table_12093(a int);
+create function func_12093()
+returns int
+begin
+return (select count(*) from table_12093);
+end//
+create procedure proc_12093(a int)
+begin
+select * from table_12093;
+end//
+create function func_12093_unrelated() returns int return 2;
+create procedure proc_12093_unrelated() begin end;
+prepare stmt_sf from 'select func_12093();';
+prepare stmt_sp from 'call proc_12093(func_12093())';
+execute stmt_sf;
+func_12093()
+0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_sp;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function func_12093_unrelated;
+drop procedure proc_12093_unrelated;
+execute stmt_sf;
+func_12093()
+0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_sp;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_sf;
+func_12093()
+0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt_sp;
+a
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+deallocate prepare stmt_sf;
+deallocate prepare stmt_sp;
+drop table table_12093;
+drop function func_12093;
+drop procedure proc_12093;
+drop function if exists func_21294;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create function func_21294() returns int return 10;
+prepare stmt from "select func_21294()";
+execute stmt;
+func_21294()
+10
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function func_21294;
+create function func_21294() returns int return 10;
+execute stmt;
+func_21294()
+10
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop function func_21294;
+create function func_21294() returns int return 20;
+execute stmt;
+func_21294()
+20
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+deallocate prepare stmt;
+drop function func_21294;
+drop table if exists t_27420_100;
+drop table if exists t_27420_101;
+drop view if exists v_27420;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t_27420_100(a int);
+insert into t_27420_100 values (1), (2);
+create table t_27420_101(a int);
+insert into t_27420_101 values (1), (2);
+create view v_27420 as select t_27420_100.a X, t_27420_101.a Y
+from t_27420_100, t_27420_101
+where t_27420_100.a=t_27420_101.a;
+prepare stmt from 'select * from v_27420';
+execute stmt;
+X Y
+1 1
+2 2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop view v_27420;
+create table v_27420(X int, Y int);
+execute stmt;
+X Y
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+drop table v_27420;
+create table v_27420 (a int, b int, filler char(200));
+execute stmt;
+a b filler
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+2
+deallocate prepare stmt;
+drop table t_27420_100;
+drop table t_27420_101;
+drop table v_27420;
+drop table if exists t_27430_1;
+drop table if exists t_27430_2;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t_27430_1 (a int not null, oref int not null, key(a));
+insert into t_27430_1 values
+(1, 1),
+(1, 1234),
+(2, 3),
+(2, 1234),
+(3, 1234);
+create table t_27430_2 (a int not null, oref int not null);
+insert into t_27430_2 values
+(1, 1),
+(2, 2),
+(1234, 3),
+(1234, 4);
+prepare stmt from
+'select oref, a, a in (select a from t_27430_1 where oref=t_27430_2.oref) Z from t_27430_2';
+execute stmt;
+oref a Z
+1 1 1
+2 2 0
+3 1234 0
+4 1234 0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+oref a Z
+1 1 1
+2 2 0
+3 1234 0
+4 1234 0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table t_27430_1, t_27430_2;
+create table t_27430_1 (a int, oref int, key(a));
+insert into t_27430_1 values
+(1, 1),
+(1, NULL),
+(2, 3),
+(2, NULL),
+(3, NULL);
+create table t_27430_2 (a int, oref int);
+insert into t_27430_2 values
+(1, 1),
+(2,2),
+(NULL, 3),
+(NULL, 4);
+execute stmt;
+oref a Z
+1 1 1
+2 2 0
+3 NULL NULL
+4 NULL 0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+oref a Z
+1 1 1
+2 2 0
+3 NULL NULL
+4 NULL 0
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+deallocate prepare stmt;
+drop table t_27430_1;
+drop table t_27430_2;
+drop table if exists t_27690_1;
+drop view if exists v_27690_1;
+drop table if exists v_27690_2;
+SELECT VARIABLE_VALUE from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE'
+into @base_count ;
+create table t_27690_1 (a int, b int);
+insert into t_27690_1 values (1,1),(2,2);
+create table v_27690_1 as select * from t_27690_1;
+create table v_27690_2 as select * from t_27690_1;
+prepare stmt from 'select * from v_27690_1, v_27690_2';
+execute stmt;
+a b a b
+1 1 1 1
+2 2 1 1
+1 1 2 2
+2 2 2 2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+a b a b
+1 1 1 1
+2 2 1 1
+1 1 2 2
+2 2 2 2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+drop table v_27690_1;
+execute stmt;
+ERROR 42S02: Table 'test.v_27690_1' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+execute stmt;
+ERROR 42S02: Table 'test.v_27690_1' doesn't exist
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+0
+create view v_27690_1 as select A.a, A.b from t_27690_1 A, t_27690_1 B;
+execute stmt;
+a b a b
+1 1 1 1
+2 2 1 1
+1 1 1 1
+2 2 1 1
+1 1 2 2
+2 2 2 2
+1 1 2 2
+2 2 2 2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+execute stmt;
+a b a b
+1 1 1 1
+2 2 1 1
+1 1 1 1
+2 2 1 1
+1 1 2 2
+2 2 2 2
+1 1 2 2
+2 2 2 2
+SELECT VARIABLE_VALUE - @base_count AS REPREPARED from
+INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ;
+REPREPARED
+1
+deallocate prepare stmt;
+drop table t_27690_1;
+drop view v_27690_1;
+drop table v_27690_2;
diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result
new file mode 100644
index 00000000000..f177bfac836
--- /dev/null
+++ b/mysql-test/r/query_cache_debug.result
@@ -0,0 +1,24 @@
+flush status;
+set query_cache_type=DEMAND;
+set global query_cache_size= 1024*1024*512;
+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';
+select SQL_CACHE * from t1;;
+On a second connection; clear the query cache.
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 1
+set global query_cache_size= 0;
+Signal the debug hook to release the lock.
+select id from information_schema.processlist where state='wait_in_query_cache_insert' into @thread_id;
+kill query @thread_id;
+Show query cache status.
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 0
+set global query_cache_size= 0;
+use test;
+drop table t1;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 108264b3bf2..92db6d8429f 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1135,6 +1135,24 @@ item started price
A1 2005-11-01 08:00:00 1000.000
A1 2005-11-15 00:00:00 2000.000
DROP TABLE t1;
+
+BUG#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
+
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+dateval date default NULL,
+PRIMARY KEY (id),
+KEY dateval (dateval)
+) AUTO_INCREMENT=173;
+INSERT INTO t1 VALUES
+(1,'2007-01-01'),(2,'2007-01-02'),(3,'2007-01-03'),(4,'2007-01-04'),
+(5,'2007-01-05'),(6,'2007-01-06'),(7,'2007-01-07'),(8,'2007-01-08'),
+(9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11');
+This must use range access:
+explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where
+drop table t1;
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, filler char(100));
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result
index f270f1ed5ad..cf81566f4e5 100644
--- a/mysql-test/r/read_only.result
+++ b/mysql-test/r/read_only.result
@@ -97,3 +97,31 @@ Note 1051 Unknown table 'ttt'
set global read_only=0;
drop table t1,t2;
drop user test@localhost;
+#
+# Bug #27440 read_only allows create and drop database
+#
+set global read_only= 1;
+drop database if exists mysqltest_db1;
+drop database if exists mysqltest_db2;
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+delete from mysql.tables_priv where User like 'mysqltest_%';
+delete from mysql.columns_priv where User like 'mysqltest_%';
+flush privileges;
+grant all on mysqltest_db2.* to `mysqltest_u1`@`%`;
+create database mysqltest_db1;
+grant all on mysqltest_db1.* to `mysqltest_u1`@`%`;
+flush privileges;
+create database mysqltest_db2;
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+show databases like '%mysqltest_db2%';
+Database (%mysqltest_db2%)
+drop database mysqltest_db1;
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+delete from mysql.tables_priv where User like 'mysqltest_%';
+delete from mysql.columns_priv where User like 'mysqltest_%';
+flush privileges;
+drop database mysqltest_db1;
+set global read_only=0;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 719d0926022..2f305f6ec5d 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4307,6 +4307,12 @@ c3
DROP TABLE t1;
DROP TABLE t2;
+CREATE TABLE t1 (c1 BIGINT NOT NULL);
+INSERT INTO t1 (c1) VALUES (1);
+SELECT * FROM t1 WHERE c1 > NULL + 1;
+c1
+DROP TABLE t1;
+
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result
index bf0f16a174f..b523f2edc9f 100644
--- a/mysql-test/r/skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -72,10 +72,6 @@ count(*)
select count(*) from information_schema.USER_PRIVILEGES;
count(*)
0
-CREATE FUNCTION a RETURNS STRING SONAME '';
-ERROR HY000: Can't initialize function 'a'; UDFs are unavailable with the --skip-grant-tables option
-DROP FUNCTION a;
-ERROR 42000: FUNCTION test.a does not exist
End of 5.0 tests
#
# Bug#29817 Queries with UDF fail with non-descriptive error
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index 018173e723d..ca5c5b42102 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -733,6 +733,115 @@ optimizer: keep hreturn
drop table t1;
drop procedure proc_26977_broken;
drop procedure proc_26977_works;
+drop procedure if exists proc_33618_h;
+drop procedure if exists proc_33618_c;
+create procedure proc_33618_h(num int)
+begin
+declare count1 int default '0';
+declare vb varchar(30);
+declare last_row int;
+while(num>=1) do
+set num=num-1;
+begin
+declare cur1 cursor for select `a` from t_33618;
+declare continue handler for not found set last_row = 1;
+set last_row:=0;
+open cur1;
+rep1:
+repeat
+begin
+declare exit handler for 1062 begin end;
+fetch cur1 into vb;
+if (last_row = 1) then
+## should generate a hpop instruction here
+leave rep1;
+end if;
+end;
+until last_row=1
+end repeat;
+close cur1;
+end;
+end while;
+end//
+create procedure proc_33618_c(num int)
+begin
+declare count1 int default '0';
+declare vb varchar(30);
+declare last_row int;
+while(num>=1) do
+set num=num-1;
+begin
+declare cur1 cursor for select `a` from t_33618;
+declare continue handler for not found set last_row = 1;
+set last_row:=0;
+open cur1;
+rep1:
+repeat
+begin
+declare cur2 cursor for select `b` from t_33618;
+fetch cur1 into vb;
+if (last_row = 1) then
+## should generate a cpop instruction here
+leave rep1;
+end if;
+end;
+until last_row=1
+end repeat;
+close cur1;
+end;
+end while;
+end//
+show procedure code proc_33618_h;
+Pos Instruction
+0 set count1@1 _latin1'0'
+1 set vb@2 NULL
+2 set last_row@3 NULL
+3 jump_if_not 24(24) (num@0 >= 1)
+4 set num@0 (num@0 - 1)
+5 cpush cur1@0
+6 hpush_jump 9 4 CONTINUE
+7 set last_row@3 1
+8 hreturn 4
+9 set last_row@3 0
+10 copen cur1@0
+11 hpush_jump 13 4 EXIT
+12 hreturn 0 17
+13 cfetch cur1@0 vb@2
+14 jump_if_not 17(17) (last_row@3 = 1)
+15 hpop 1
+16 jump 19
+17 hpop 1
+18 jump_if_not 11(19) (last_row@3 = 1)
+19 cclose cur1@0
+20 hpop 1
+21 cpop 1
+22 jump 3
+show procedure code proc_33618_c;
+Pos Instruction
+0 set count1@1 _latin1'0'
+1 set vb@2 NULL
+2 set last_row@3 NULL
+3 jump_if_not 23(23) (num@0 >= 1)
+4 set num@0 (num@0 - 1)
+5 cpush cur1@0
+6 hpush_jump 9 4 CONTINUE
+7 set last_row@3 1
+8 hreturn 4
+9 set last_row@3 0
+10 copen cur1@0
+11 cpush cur2@1
+12 cfetch cur1@0 vb@2
+13 jump_if_not 16(16) (last_row@3 = 1)
+14 cpop 1
+15 jump 18
+16 cpop 1
+17 jump_if_not 11(18) (last_row@3 = 1)
+18 cclose cur1@0
+19 hpop 1
+20 cpop 1
+21 jump 3
+drop procedure proc_33618_h;
+drop procedure proc_33618_c;
End of 5.0 tests.
CREATE PROCEDURE p1()
BEGIN
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index b81f8ea64c9..c33c378340e 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1579,3 +1579,51 @@ drop function f2;
drop table t2;
ERROR 42S02: Unknown table 't2'
End of 5.1 tests
+drop procedure if exists proc_33983_a;
+drop procedure if exists proc_33983_b;
+drop procedure if exists proc_33983_c;
+drop procedure if exists proc_33983_d;
+create procedure proc_33983_a()
+begin
+label1:
+begin
+label2:
+begin
+select 1;
+end label1;
+end;
+end|
+ERROR 42000: End-label label1 without match
+create procedure proc_33983_b()
+begin
+label1:
+repeat
+label2:
+repeat
+select 1;
+until FALSE end repeat label1;
+until FALSE end repeat;
+end|
+ERROR 42000: End-label label1 without match
+create procedure proc_33983_c()
+begin
+label1:
+while TRUE do
+label2:
+while TRUE do
+select 1;
+end while label1;
+end while;
+end|
+ERROR 42000: End-label label1 without match
+create procedure proc_33983_d()
+begin
+label1:
+loop
+label2:
+loop
+select 1;
+end loop label1;
+end loop;
+end|
+ERROR 42000: End-label label1 without match
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 68aa278585f..50ece83b258 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -6812,7 +6812,59 @@ DROP PROCEDURE db28318_b.t2;
DROP DATABASE db28318_a;
DROP DATABASE db28318_b;
use test;
-End of 5.0 tests
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS bug29770;
+CREATE TABLE t1(a int);
+CREATE PROCEDURE bug29770()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '42S22' SET @state:= 'run';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @exception:= 'run';
+SELECT x FROM t1;
+END|
+CALL bug29770();
+SELECT @state, @exception;
+@state @exception
+run NULL
+DROP TABLE t1;
+DROP PROCEDURE bug29770;
+use test;
+drop table if exists t_33618;
+drop procedure if exists proc_33618;
+create table t_33618 (`a` int, unique(`a`), `b` varchar(30)) engine=myisam;
+insert into t_33618 (`a`,`b`) values (1,'1'),(2,'2');
+create procedure proc_33618(num int)
+begin
+declare count1 int default '0';
+declare vb varchar(30);
+declare last_row int;
+while(num>=1) do
+set num=num-1;
+begin
+declare cur1 cursor for select `a` from t_33618;
+declare continue handler for not found set last_row = 1;
+set last_row:=0;
+open cur1;
+rep1:
+repeat
+begin
+declare exit handler for 1062 begin end;
+fetch cur1 into vb;
+if (last_row = 1) then
+leave rep1;
+end if;
+end;
+until last_row=1
+end repeat;
+close cur1;
+end;
+end while;
+end//
+call proc_33618(20);
+drop table t_33618;
+drop procedure proc_33618;
+# ------------------------------------------------------------------
+# -- End of 5.0 tests
+# ------------------------------------------------------------------
#
# Bug#20550.
@@ -6911,4 +6963,6 @@ END latin1 latin1_swedish_ci latin1_swedish_ci
DROP FUNCTION f1;
-End of 5.1 tests
+# ------------------------------------------------------------------
+# -- End of 5.1 tests
+# ------------------------------------------------------------------
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
index a835b06858b..7a6173b89e2 100644
--- a/mysql-test/r/sp_trans_log.result
+++ b/mysql-test/r/sp_trans_log.result
@@ -16,6 +16,7 @@ insert into t2 values (bug23333(),1)|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from 106 /* with fixes for #23333 will show there is the query */|
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # #
master-bin.000001 # Table_map 1 # #
master-bin.000001 # Table_map 1 # #
master-bin.000001 # Write_rows 1 # #
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index db75044ee5d..fc78f4ad40f 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -8,6 +8,8 @@ VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 2
TABLE_LOCKS_WAITED 0
SET SQL_LOG_BIN=0;
+set @old_general_log = @@global.general_log;
+set global general_log = 'OFF';
drop table if exists t1;
create table t1(n int) engine=myisam;
insert into t1 values(1);
@@ -20,6 +22,7 @@ show status like 'Table_locks_waited';
Variable_name Value
Table_locks_waited 1
drop table t1;
+set global general_log = @old_general_log;
select 1;
1
1
@@ -159,3 +162,24 @@ Variable_name Value
Com_show_status 8
rnd_diff tmp_table_diff
20 8
+show global status like 'Com%function%';
+Variable_name Value
+Com_alter_function 0
+Com_create_function 0
+Com_drop_function 0
+Com_show_function_code 0
+Com_show_function_status 0
+create function f1 (x INTEGER) returns integer
+begin
+declare ret integer;
+set ret = x * 10;
+return ret;
+end //
+drop function f1;
+show global status like 'Com%function%';
+Variable_name Value
+Com_alter_function 0
+Com_create_function 1
+Com_drop_function 1
+Com_show_function_code 0
+Com_show_function_status 0
diff --git a/mysql-test/r/strict_autoinc_4bdb.result b/mysql-test/r/strict_autoinc_4bdb.result
deleted file mode 100644
index 2e8980e435b..00000000000
--- a/mysql-test/r/strict_autoinc_4bdb.result
+++ /dev/null
@@ -1,28 +0,0 @@
-drop table if exists t1;
-set @org_mode=@@sql_mode;
-create table t1
-(
-`a` tinyint(4) NOT NULL auto_increment,
-primary key (`a`)
-) engine = 'BDB' ;
-set @@sql_mode='strict_all_tables';
-insert into t1 values(1000);
-ERROR 22003: Out of range value for column 'a' at row 1
-select count(*) from t1;
-count(*)
-0
-set auto_increment_increment=1000;
-set auto_increment_offset=700;
-insert into t1 values(null);
-ERROR 22003: Out of range value for column 'a' at row 1
-select count(*) from t1;
-count(*)
-0
-set @@sql_mode=@org_mode;
-insert into t1 values(null);
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
-select * from t1;
-a
-127
-drop table t1;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 25df7a56aa3..20d44933128 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -77,10 +77,9 @@ ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
-a
+ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
-a
-1
+ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1,2,3) = ROW(1,2,3);
(SELECT 1,2,3) = ROW(1,2,3)
1
@@ -1307,7 +1306,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where (`test`.`t1`.`b` <> 30))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1315,8 +1314,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where
-2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00
+2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
drop table t1, t2, t3;
@@ -1334,9 +1333,9 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
-2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a)))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
2
@@ -1346,7 +1345,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (`test`.`t1`.`b` <> 30))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
a
2
@@ -1373,7 +1372,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (`test`.`t1`.`b` <> 30))))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
drop table t1, t2, t3;
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1737,7 +1736,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
Warnings:
-Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where (`test`.`t1`.`id` < 8))))))
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
@@ -2304,24 +2303,27 @@ drop table t1,t2;
CREATE TABLE t1 ( a int, b int );
CREATE TABLE t2 ( c int, d int );
INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
-SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+SELECT a AS abc, b FROM t1 outr WHERE b =
+(SELECT MIN(b) FROM t1 WHERE a=outr.a);
abc b
1 2
2 3
3 4
-INSERT INTO t2 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
+(SELECT MIN(b) FROM t1 WHERE a=outr.a);
select * from t2;
c d
1 2
2 3
3 4
-CREATE TABLE t3 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);
+CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
+(SELECT MIN(b) FROM t1 WHERE a=outr.a);
select * from t3;
abc b
1 2
2 3
3 4
-prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);";
+prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
execute stmt1;
deallocate prepare stmt1;
select * from t2;
@@ -2333,7 +2335,7 @@ c d
2 3
3 4
drop table t3;
-prepare stmt1 from "CREATE TABLE t3 SELECT a AS abc, b FROM t1 WHERE b = (SELECT MIN(b) FROM t1 WHERE a=abc);";
+prepare stmt1 from "CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
execute stmt1;
select * from t3;
abc b
@@ -2515,7 +2517,9 @@ INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,680
INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
-SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
+SELECT DISTINCT Continent AS c FROM t1 outr WHERE
+Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
+Population < 200);
c
Oceania
drop table t1;
@@ -3558,22 +3562,19 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
(SELECT i FROM t1) UNION
(SELECT i FROM t1)
);
-i
+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 3
SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
-i
+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 tables used
-3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-4 UNION t12 system NULL NULL NULL NULL 0 const row not found
-NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL
+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))' at line 2
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
insert into t1 (a) values (FLOOR(rand() * 100));
@@ -3666,6 +3667,8 @@ CREATE TABLE t1 (a int, b int auto_increment, PRIMARY KEY (b));
CREATE TABLE t2 (x int auto_increment, y int, z int,
PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
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;
@@ -4101,6 +4104,8 @@ INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26');
INSERT INTO `t2` VALUES ('abcdefghijk');
INSERT INTO `t2` VALUES ('asdf');
SET session sort_buffer_size=8192;
+Warnings:
+Warning 1292 Truncated incorrect sort_buffer_size value: '8192'
SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2;
d1
1
@@ -4199,6 +4204,141 @@ LEFT(t1.a1,1)
SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3);
a2
DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (a CHAR(1), b VARCHAR(10));
+INSERT INTO t1 VALUES ('a', 'aa');
+INSERT INTO t1 VALUES ('a', 'aaa');
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
+a b
+CREATE INDEX I1 ON t1 (a);
+CREATE INDEX I2 ON t1 (b);
+EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
+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 t1 index_subquery I1 I1 2 func 2 Using index; Using where
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
+a b
+CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
+INSERT INTO t2 SELECT * FROM t1;
+CREATE INDEX I1 ON t2 (a);
+CREATE INDEX I2 ON t2 (b);
+EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where
+SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
+a b
+EXPLAIN
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
+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 t1 index_subquery I1 I1 2 func 2 Using index; Using where
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
+a b
+DROP TABLE t1,t2;
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (2,3), (2,4);
+EXPLAIN
+SELECT a AS out_a, MIN(b) FROM t1
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
+GROUP BY a;
+ERROR 42S22: Unknown column 'out_a' in 'where clause'
+SELECT a AS out_a, MIN(b) FROM t1
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
+GROUP BY a;
+ERROR 42S22: Unknown column 'out_a' in 'where clause'
+EXPLAIN
+SELECT a AS out_a, MIN(b) FROM t1 t1_outer
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
+GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT a AS out_a, MIN(b) FROM t1 t1_outer
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
+GROUP BY a;
+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 exists(select 1 AS `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));
+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 FROM t2 WHERE t1.a = t2.a))' at line 2
+DROP TABLE t1,t2;
+create table t1(f11 int, f12 int);
+create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
+insert into t1 values(1,1),(2,2), (3, 3);
+set session sort_buffer_size= 33*1024;
+select count(*) from t1 where f12 =
+(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
+count(*)
+3
+drop table t1,t2;
+CREATE TABLE t4 (
+f7 varchar(32) collate utf8_bin NOT NULL default '',
+f10 varchar(32) collate utf8_bin default NULL,
+PRIMARY KEY (f7)
+);
+INSERT INTO t4 VALUES(1,1), (2,null);
+CREATE TABLE t2 (
+f4 varchar(32) collate utf8_bin NOT NULL default '',
+f2 varchar(50) collate utf8_bin default NULL,
+f3 varchar(10) collate utf8_bin default NULL,
+PRIMARY KEY (f4),
+UNIQUE KEY uk1 (f2)
+);
+INSERT INTO t2 VALUES(1,1,null), (2,2,null);
+CREATE TABLE t1 (
+f8 varchar(32) collate utf8_bin NOT NULL default '',
+f1 varchar(10) collate utf8_bin default NULL,
+f9 varchar(32) collate utf8_bin default NULL,
+PRIMARY KEY (f8)
+);
+INSERT INTO t1 VALUES (1,'P',1), (2,'P',1), (3,'R',2);
+CREATE TABLE t3 (
+f6 varchar(32) collate utf8_bin NOT NULL default '',
+f5 varchar(50) collate utf8_bin default NULL,
+PRIMARY KEY (f6)
+);
+INSERT INTO t3 VALUES (1,null), (2,null);
+SELECT
+IF(t1.f1 = 'R', a1.f2, t2.f2) AS a4,
+IF(t1.f1 = 'R', a1.f3, t2.f3) AS f3,
+SUM(
+IF(
+(SELECT VPC.f2
+FROM t2 VPC, t4 a2, t2 a3
+WHERE
+VPC.f4 = a2.f10 AND a3.f2 = a4
+LIMIT 1) IS NULL,
+0,
+t3.f5
+)
+) AS a6
+FROM
+t2, t3, t1 JOIN t2 a1 ON t1.f9 = a1.f4
+GROUP BY a4;
+a4 f3 a6
+1 NULL NULL
+2 NULL NULL
+DROP TABLE t1, t2, t3, t4;
End of 5.0 tests.
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 2f3ea31a2a4..ac492caf89a 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -757,6 +757,6 @@ a
EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
-2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index
+2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where
DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/subselect_notembedded.result b/mysql-test/r/subselect_notembedded.result
index 44ae055425e..90aadcae398 100644
--- a/mysql-test/r/subselect_notembedded.result
+++ b/mysql-test/r/subselect_notembedded.result
@@ -1,3 +1,104 @@
purge master logs before (select adddate(current_timestamp(), interval -4 day));
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 'select adddate(current_timestamp(), interval -4 day))' at line 1
purge master logs before adddate(current_timestamp(), interval -4 day);
+create table t1(a int,b int,key(a),key(b));
+insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
+(6,7),(7,4),(5,3);
+select sum(a),a from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1
+)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1)
+group by a;
+sum(a) a
+select sum(a),a from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1)
+group by a;
+ERROR HY000: Thread stack overrun detected
+explain select sum(a),a from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1
+)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1)
+group by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index a a 5 NULL 9 Using where; Using index
+2 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+3 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+4 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+5 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+6 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+7 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+8 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+9 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+10 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+11 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort
+12 SUBQUERY t1 range a a 5 NULL 1 Using where; Using temporary; Using filesort
+13 SUBQUERY t1 index NULL a 5 NULL 9 Using index
+explain select sum(a),a from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
+select sum(a) from t1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1
+)group by b limit 1)group by b limit 1)group by b limit 1)
+group by a;
+ERROR HY000: Thread stack overrun detected
+drop table t1;
diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result
index d56f83993a6..87e8f68da38 100644
--- a/mysql-test/r/trigger_notembedded.result
+++ b/mysql-test/r/trigger_notembedded.result
@@ -448,4 +448,18 @@ DROP TABLE t1;
DROP DATABASE mysqltest_db1;
USE test;
End of 5.0 tests.
+drop table if exists t1;
+create table t1 (i int);
+connection: default
+lock tables t1 write;
+connection: flush
+flush tables with read lock;;
+connection: default
+create trigger t1_bi before insert on t1 for each row begin end;
+unlock tables;
+connection: flush
+unlock tables;
+select * from t1;
+i
+drop table t1;
End of 5.1 tests.
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index dc8ab079ad8..fee0df9ab02 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -269,6 +269,8 @@ a+0 b+0
56 379
68 454
set @@max_length_for_sort_data=0;
+Warnings:
+Warning 1292 Truncated incorrect max_length_for_sort_data value: '0'
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
a+0 b+0
57 135
@@ -672,6 +674,16 @@ COUNT(DISTINCT b,c)
2
2
DROP TABLE t2;
+CREATE TABLE t1(a BIT(13), KEY(a));
+INSERT INTO t1(a) VALUES
+(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
+EXPLAIN SELECT 1 FROM t1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL a 3 NULL 6 Using index for group-by
+SELECT 1 FROM t1 GROUP BY a;
+1
+1
+DROP TABLE t1;
End of 5.0 tests
create table t1(a bit(7));
insert into t1 values(0x40);
diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
index 97331408b40..a9c3cae1770 100644
--- a/mysql-test/r/type_bit_innodb.result
+++ b/mysql-test/r/type_bit_innodb.result
@@ -269,6 +269,8 @@ a+0 b+0
56 379
68 454
set @@max_length_for_sort_data=0;
+Warnings:
+Warning 1292 Truncated incorrect max_length_for_sort_data value: '0'
select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
a+0 b+0
57 135
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 869efb535e6..c98c8c5b68c 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -807,4 +807,18 @@ set @@sql_mode='TRADITIONAL';
create table t1 (a text default '');
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
set @@sql_mode='';
+CREATE TABLE t (c TEXT CHARSET ASCII);
+INSERT INTO t (c) VALUES (REPEAT('1',65537));
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t (c) VALUES (REPEAT('2',65536));
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+INSERT INTO t (c) VALUES (REPEAT('3',65535));
+SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
+LENGTH(c) CHAR_LENGTH(c)
+65535 65535
+65535 65535
+65535 65535
+DROP TABLE t;
End of 5.0 tests
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 392260edb55..7cb71831bce 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -211,7 +211,6 @@ a
Warnings:
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
-Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
SELECT * FROM t2 WHERE a = '0000-00-00';
a
0000-00-00
@@ -223,6 +222,49 @@ INSERT INTO t1 VALUES ('0000-00-00');
ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
+CREATE TABLE t1 (a DATE);
+CREATE TABLE t2 (a DATE);
+CREATE INDEX i ON t1 (a);
+INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00');
+INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00');
+SELECT * FROM t1 WHERE a = '1000-00-00';
+a
+1000-00-00
+1000-00-00
+SELECT * FROM t2 WHERE a = '1000-00-00';
+a
+1000-00-00
+1000-00-00
+SET SQL_MODE=TRADITIONAL;
+EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
+Warnings:
+Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1
+SELECT * FROM t1 WHERE a = '1000-00-00';
+a
+1000-00-00
+1000-00-00
+Warnings:
+Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1
+SELECT * FROM t2 WHERE a = '1000-00-00';
+a
+1000-00-00
+1000-00-00
+Warnings:
+Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '1000-00-00' for column 'a' at row 1
+INSERT INTO t1 VALUES ('1000-00-00');
+ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1
+SET SQL_MODE=DEFAULT;
+DROP TABLE t1,t2;
+CREATE TABLE t1 SELECT curdate() AS f1;
+SELECT hour(f1), minute(f1), second(f1) FROM t1;
+hour(f1) minute(f1) second(f1)
+0 0 0
+DROP TABLE t1;
End of 5.0 tests
create table t1 (a date, primary key (a))engine=memory;
insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01');
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index c15deb8b1e5..d485c468a39 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -505,6 +505,61 @@ select sum(a) from t1 group by convert(a, datetime);
sum(a)
NULL
drop table t1;
+create table t1 (id int(10) not null, cur_date datetime not null);
+create table t2 (id int(10) not null, cur_date date not null);
+insert into t1 (id, cur_date) values (1, '2007-04-25 18:30:22');
+insert into t2 (id, cur_date) values (1, '2007-04-25');
+explain extended
+select * from t1
+where id in (select id from t1 as x1 where (t1.cur_date is null));
+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
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+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` where <in_optimizer>('1',<exists>(select 1 AS `Not_used` from `test`.`t1` `x1` where 0))
+select * from t1
+where id in (select id from t1 as x1 where (t1.cur_date is null));
+id cur_date
+explain extended
+select * from t2
+where id in (select id from t2 as x1 where (t2.cur_date is null));
+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
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+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` where <in_optimizer>('1',<exists>(select 1 AS `Not_used` from `test`.`t2` `x1` where 0))
+select * from t2
+where id in (select id from t2 as x1 where (t2.cur_date is null));
+id cur_date
+insert into t1 (id, cur_date) values (2, '2007-04-26 18:30:22');
+insert into t2 (id, cur_date) values (2, '2007-04-26');
+explain extended
+select * from t1
+where id in (select id from t1 as x1 where (t1.cur_date is null));
+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 x1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`id`,<exists>(select 1 AS `Not_used` from `test`.`t1` `x1` where ((`test`.`t1`.`cur_date` = 0) and (<cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`))))
+select * from t1
+where id in (select id from t1 as x1 where (t1.cur_date is null));
+id cur_date
+explain extended
+select * from t2
+where id in (select id from t2 as x1 where (t2.cur_date is null));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 AS `Not_used` from `test`.`t2` `x1` where ((`test`.`t2`.`cur_date` = 0) and (<cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`))))
+select * from t2
+where id in (select id from t2 as x1 where (t2.cur_date is null));
+id cur_date
+drop table t1,t2;
End of 5.0 tests
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index e37a398d22e..3e5f6a9b504 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -786,10 +786,6 @@ from (select 1 as s,'t' as t union select null, null ) as sub1;
select group_concat(t) from t1 group by week(date)/10;
group_concat(t)
t
-Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00'
-Warning 1292 Incorrect datetime value: '0000-00-00'
-Warning 1292 Incorrect datetime value: '0000-00-00'
drop table t1;
CREATE TABLE t1 (
qty decimal(16,6) default NULL,
@@ -798,7 +794,7 @@ dps tinyint(3) unsigned default NULL
INSERT INTO t1 VALUES (1.1325,3);
SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1;
ROUND(qty,3) dps ROUND(qty,dps)
-1.133 3 1.133
+1.133 3 1.133000
DROP TABLE t1;
SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS '%';
%
@@ -889,4 +885,65 @@ c
1000
1234567890
DROP TABLE t1, t2, t3, t4;
+CREATE TABLE t1( a DECIMAL(4, 3), b INT );
+INSERT INTO t1 VALUES ( 1, 5 ), ( 2, 4 ), ( 3, 3 ), ( 4, 2 ), ( 5, 1 );
+SELECT a, b, ROUND( a, b ) AS c FROM t1 ORDER BY c;
+a b c
+1.000 5 1.000
+2.000 4 2.000
+3.000 3 3.000
+4.000 2 4.000
+5.000 1 5.000
+SELECT a, b, ROUND( a, b ) AS c FROM t1 ORDER BY c DESC;
+a b c
+5.000 1 5.000
+4.000 2 4.000
+3.000 3 3.000
+2.000 4 2.000
+1.000 5 1.000
+CREATE TABLE t2 ( a INT, b INT, c DECIMAL(5, 4) );
+INSERT INTO t2 VALUES ( 0, 1, 1.2345 ), ( 1, 2, 1.2345 ),
+( 3, 3, 1.2345 ), ( 2, 4, 1.2345 );
+SELECT a, b, MAX(ROUND(c, a))
+FROM t2
+GROUP BY a, b
+ORDER BY b;
+a b MAX(ROUND(c, a))
+0 1 1.0000
+1 2 1.2000
+3 3 1.2350
+2 4 1.2300
+SELECT a, b, ROUND(c, a)
+FROM t2;
+a b ROUND(c, a)
+0 1 1.0000
+1 2 1.2000
+3 3 1.2350
+2 4 1.2300
+CREATE TABLE t3( a INT, b DECIMAL(6, 3) );
+INSERT INTO t3 VALUES( 0, 1.5 );
+SELECT ROUND( b, a ) FROM t3;
+ROUND( b, a )
+2.000
+CREATE TABLE t4( a INT, b DECIMAL( 12, 0) );
+INSERT INTO t4 VALUES( -9, 1.5e9 );
+SELECT ROUND( b, a ) FROM t4;
+ROUND( b, a )
+2000000000
+CREATE TABLE t5( a INT, b DECIMAL( 13, 12 ) );
+INSERT INTO t5 VALUES( 0, 1.5 );
+INSERT INTO t5 VALUES( 9, 1.5e-9 );
+SELECT ROUND( b, a ) FROM t5;
+ROUND( b, a )
+2.000000000000
+0.000000002000
+CREATE TABLE t6( a INT );
+INSERT INTO t6 VALUES( 6 / 8 );
+SELECT * FROM t6;
+a
+1
+SELECT ROUND(20061108085411.000002);
+ROUND(20061108085411.000002)
+20061108085411
+DROP TABLE t1, t2, t3, t4, t5, t6;
End of 5.0 tests
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 24be10a7a29..71be41b106f 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1509,6 +1509,26 @@ SELECT 1 FROM t1 GROUP BY @b := @a, @b;
1
1
DROP TABLE t1;
+CREATE TABLE t1 SELECT 0.123456789012345678901234567890123456 AS f1;
+Warnings:
+Note 1265 Data truncated for column 'f1' at row 1
+DESC t1;
+Field Type Null Key Default Extra
+f1 decimal(31,30) NO 0.000000000000000000000000000000
+SELECT f1 FROM t1;
+f1
+0.123456789012345678901234567890
+DROP TABLE t1;
+CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1;
+Warnings:
+Warning 1264 Out of range value for column 'f1' at row 1
+DESC t1;
+Field Type Null Key Default Extra
+f1 decimal(59,30) NO 0.000000000000000000000000000000
+SELECT f1 FROM t1;
+f1
+99999999999999999999999999999.999999999999999999999999999999
+DROP TABLE t1;
End of 5.0 tests
select cast(143.481 as decimal(4,1));
cast(143.481 as decimal(4,1))
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index cb5afcf5f17..15410ac2039 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -365,4 +365,31 @@ DROP FUNCTION check_const_len;
DROP PROCEDURE check_const_len_sp;
DROP TRIGGER check_const_len_trigger;
DROP TABLE const_len_bug;
+CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (4),(3),(2),(1);
+INSERT INTO t2 SELECT * FROM t1;
+SELECT sequence() AS seq, a FROM t1 ORDER BY seq ASC;
+seq a
+1 4
+2 3
+3 2
+4 1
+SELECT sequence() AS seq, a FROM t1 ORDER BY seq DESC;
+seq a
+4 1
+3 2
+2 3
+1 4
+SELECT * FROM t1 WHERE a = sequence();
+a
+SELECT * FROM t2 WHERE a = sequence();
+a
+1
+2
+3
+4
+DROP FUNCTION sequence;
+DROP TABLE t1,t2;
End of 5.0 tests.
diff --git a/mysql-test/r/udf_skip_grants.result b/mysql-test/r/udf_skip_grants.result
new file mode 100644
index 00000000000..8d7081ebf6f
--- /dev/null
+++ b/mysql-test/r/udf_skip_grants.result
@@ -0,0 +1,5 @@
+CREATE FUNCTION a RETURNS STRING SONAME '';
+ERROR HY000: Can't initialize function 'a'; UDFs are unavailable with the --skip-grant-tables option
+DROP FUNCTION a;
+ERROR 42000: FUNCTION test.a does not exist
+End of 5.0 tests
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 6fc630ec33c..295451867c8 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1445,4 +1445,79 @@ select @var;
1
(select 2) union (select 1 into @var);
ERROR 42000: Result consisted of more than one row
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (10), (20);
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES (10), (50), (50);
+SELECT a,1 FROM t1
+UNION
+SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
+ORDER BY a;
+a 1
+NULL 3
+10 1
+20 1
+50 2
+SELECT a,1 FROM t1
+UNION
+SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
+ORDER BY a DESC;
+a 1
+50 2
+20 1
+10 1
+NULL 3
+SELECT a,1 FROM t1
+UNION
+SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
+ORDER BY a ASC LIMIT 3;
+a 1
+NULL 3
+10 1
+20 1
+SELECT a,1 FROM t1
+UNION ALL
+SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
+ORDER BY a DESC;
+a 1
+50 2
+20 1
+10 1
+10 1
+NULL 3
+SELECT a,1 FROM t1
+UNION
+(SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a);
+ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
+SELECT a,1 FROM t1
+UNION ALL
+SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a
+UNION
+SELECT 1,1;
+ERROR HY000: Incorrect usage of UNION and ORDER BY
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE TABLE t2 SELECT * FROM (SELECT NULL) a UNION SELECT a FROM t1;
+DESC t2;
+Field Type Null Key Default Extra
+NULL int(11) YES NULL
+CREATE TABLE t3 SELECT a FROM t1 UNION SELECT * FROM (SELECT NULL) a;
+DESC t3;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+CREATE TABLE t4 SELECT NULL;
+DESC t4;
+Field Type Null Key Default Extra
+NULL binary(0) YES NULL
+CREATE TABLE t5 SELECT NULL UNION SELECT NULL;
+DESC t5;
+Field Type Null Key Default Extra
+NULL binary(0) YES NULL
+CREATE TABLE t6
+SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
+DESC t6;
+Field Type Null Key Default Extra
+NULL int(11) YES NULL
+DROP TABLE t1, t2, t3, t4, t5, t6;
End of 5.0 tests
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index b76b399c9e2..44fcfc0c478 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -25,11 +25,13 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq
SET @@session.sql_mode=0/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
-INSERT INTO t1 VALUES(@`a b`)/*!*/;
+INSERT INTO t1 VALUES(@`a b`)
+/*!*/;
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/;
SET TIMESTAMP=10000/*!*/;
-insert into t1 values (@var1),(@var2)/*!*/;
+insert into t1 values (@var1),(@var2)
+/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 431134b03c7..2cd132ce03c 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -353,6 +353,13 @@ select @a:=f4, count(f4) from t1 group by 1 desc;
2.6 1
1.6 4
drop table t1;
+create table t1 (f1 int);
+insert into t1 values (2), (1);
+select @i := f1 as j from t1 order by 1;
+j
+1
+2
+drop table t1;
create table t1(a int);
insert into t1 values(5),(4),(4),(3),(2),(2),(2),(1);
set @rownum := 0;
diff --git a/mysql-test/r/variables+c.result b/mysql-test/r/variables+c.result
new file mode 100644
index 00000000000..7a2976d1267
--- /dev/null
+++ b/mysql-test/r/variables+c.result
@@ -0,0 +1,7 @@
+show global status like "Uptime_%";
+Variable_name Value
+Uptime_since_flush_status #
+flush status;
+show global status like "Uptime_%";
+Variable_name Value
+Uptime_since_flush_status #
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index bdaec70021b..e5c3c860c93 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -220,10 +220,10 @@ select * from information_schema.global_variables where variable_name like 'myis
VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE 1048576
set GLOBAL myisam_max_sort_file_size=default;
-show variables like 'myisam_max_sort_file_size';
+show global variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size FILE_SIZE
-select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
+select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
VARIABLE_NAME VARIABLE_VALUE
MYISAM_MAX_SORT_FILE_SIZE FILE_SIZE
set global net_retry_count=10, session net_retry_count=10;
@@ -279,6 +279,8 @@ NET_READ_TIMEOUT 600
NET_RETRY_COUNT 10
NET_WRITE_TIMEOUT 500
set net_buffer_length=1;
+Warnings:
+Warning 1292 Truncated incorrect net_buffer_length value: '1'
show variables like 'net_buffer_length';
Variable_name Value
net_buffer_length 1024
@@ -312,14 +314,14 @@ show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
-range_alloc_block_size 2048
+range_alloc_block_size 4096
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 8192
QUERY_PREALLOC_SIZE 8192
-RANGE_ALLOC_BLOCK_SIZE 2048
+RANGE_ALLOC_BLOCK_SIZE 4096
TRANSACTION_ALLOC_BLOCK_SIZE 8192
TRANSACTION_PREALLOC_SIZE 4096
set @@range_alloc_block_size=1024*16;
@@ -351,14 +353,14 @@ show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
-range_alloc_block_size 2048
+range_alloc_block_size 4096
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 8192
QUERY_PREALLOC_SIZE 8192
-RANGE_ALLOC_BLOCK_SIZE 2048
+RANGE_ALLOC_BLOCK_SIZE 4096
TRANSACTION_ALLOC_BLOCK_SIZE 8192
TRANSACTION_PREALLOC_SIZE 4096
SELECT @@version LIKE 'non-existent';
@@ -416,6 +418,8 @@ select @@autocommit, @@big_tables;
@@autocommit @@big_tables
1 1
set global binlog_cache_size=100;
+Warnings:
+Warning 1292 Truncated incorrect binlog_cache_size value: '100'
set bulk_insert_buffer_size=100;
set character set cp1251_koi8;
set character set default;
@@ -444,6 +448,8 @@ set global flush_time=100;
set insert_id=1;
set interactive_timeout=100;
set join_buffer_size=100;
+Warnings:
+Warning 1292 Truncated incorrect join_buffer_size value: '100'
set last_insert_id=1;
set global local_infile=1;
set long_query_time=0.000001;
@@ -456,12 +462,20 @@ select @@long_query_time;
100.000001
set low_priority_updates=1;
set max_allowed_packet=100;
+Warnings:
+Warning 1292 Truncated incorrect max_allowed_packet value: '100'
set global max_binlog_cache_size=100;
+Warnings:
+Warning 1292 Truncated incorrect max_binlog_cache_size value: '100'
set global max_binlog_size=100;
+Warnings:
+Warning 1292 Truncated incorrect max_binlog_size value: '100'
set global max_connect_errors=100;
set global max_connections=100;
set global max_delayed_threads=100;
set max_heap_table_size=100;
+Warnings:
+Warning 1292 Truncated incorrect max_heap_table_size value: '100'
set max_join_size=100;
set max_sort_length=100;
set max_tmp_tables=100;
@@ -472,17 +486,25 @@ select @@max_user_connections;
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
set net_buffer_length=100;
+Warnings:
+Warning 1292 Truncated incorrect net_buffer_length value: '100'
set net_read_timeout=100;
set net_write_timeout=100;
set global query_cache_limit=100;
set global query_cache_size=100;
set global query_cache_type=demand;
set read_buffer_size=100;
+Warnings:
+Warning 1292 Truncated incorrect read_buffer_size value: '100'
set read_rnd_buffer_size=100;
+Warnings:
+Warning 1292 Truncated incorrect read_rnd_buffer_size value: '100'
set global rpl_recovery_rank=100;
set global server_id=100;
set global slow_launch_time=100;
set sort_buffer_size=100;
+Warnings:
+Warning 1292 Truncated incorrect sort_buffer_size value: '100'
set @@max_sp_recursion_depth=10;
select @@max_sp_recursion_depth;
@@max_sp_recursion_depth
@@ -522,6 +544,8 @@ set storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
set tmp_table_size=100;
+Warnings:
+Warning 1292 Truncated incorrect tmp_table_size value: '100'
set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
@@ -691,6 +715,8 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYI
VARIABLE_NAME VARIABLE_VALUE
MYISAM_DATA_POINTER_SIZE 7
SET GLOBAL table_open_cache=-1;
+Warnings:
+Warning 1292 Truncated incorrect table_open_cache value: '0'
SHOW VARIABLES LIKE 'table_open_cache';
Variable_name Value
table_open_cache 1
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 2971af7347d..09b997797b4 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3597,6 +3597,22 @@ DROP VIEW v1;
DROP VIEW v2;
DROP VIEW v3;
DROP TABLE t1;
+#
+# Bug#29477: Not all fields of the target table were checked to have
+# a default value when inserting into a view.
+#
+create table t1(f1 int, f2 int not null);
+create view v1 as select f1 from t1;
+insert into v1 values(1);
+Warnings:
+Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value
+set @old_mode=@@sql_mode;
+set @@sql_mode=traditional;
+insert into v1 values(1);
+ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value
+set @@sql_mode=@old_mode;
+drop view v1;
+drop table t1;
End of 5.0 tests.
DROP DATABASE IF EXISTS `d-1`;
CREATE DATABASE `d-1`;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 2929328a9b1..249cd583345 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -98,8 +98,7 @@ Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'c' at row 2
alter table t1 add d char(2);
update t1 set a=NULL where a=10;
-Warnings:
-Warning 1048 Column 'a' cannot be null
+ERROR 23000: Column 'a' cannot be null
update t1 set c='mysql ab' where c='test';
Warnings:
Warning 1265 Data truncated for column 'c' at row 4
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index c97d3dd8867..e58a891838a 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -19,6 +19,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
End of 5.0 tests.
+drop procedure if exists proc_1;
create procedure proc_1() install plugin my_plug soname '\\root\\some_plugin.dll';
call proc_1();
ERROR HY000: No paths allowed for shared library