summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/1st.result1
-rw-r--r--mysql-test/r/alter_table.result21
-rw-r--r--mysql-test/r/archive.result22
-rw-r--r--mysql-test/r/archive_debug.result12
-rw-r--r--mysql-test/r/archive_plugin.result3
-rw-r--r--mysql-test/r/auto_increment.result40
-rw-r--r--mysql-test/r/blackhole_plugin.result3
-rw-r--r--mysql-test/r/bootstrap.result12
-rw-r--r--mysql-test/r/bug58669.result17
-rw-r--r--mysql-test/r/cache_innodb.result11
-rw-r--r--mysql-test/r/cast.result17
-rw-r--r--mysql-test/r/check.result16
-rw-r--r--mysql-test/r/client_xml.result6
-rw-r--r--mysql-test/r/commit_1innodb.result8
-rw-r--r--mysql-test/r/connect.result3
-rw-r--r--mysql-test/r/csv_not_null.result3
-rw-r--r--mysql-test/r/ctype_binary.result91
-rw-r--r--mysql-test/r/ctype_cp1250_ch.result3
-rw-r--r--mysql-test/r/ctype_cp1251.result416
-rw-r--r--mysql-test/r/ctype_eucjpms.result2
-rw-r--r--mysql-test/r/ctype_latin1.result115
-rw-r--r--mysql-test/r/ctype_like_range.result2310
-rw-r--r--mysql-test/r/ctype_many.result37
-rw-r--r--mysql-test/r/ctype_sjis.result6
-rw-r--r--mysql-test/r/ctype_uca.result98
-rw-r--r--mysql-test/r/ctype_ucs.result109
-rw-r--r--mysql-test/r/ctype_ujis.result10
-rw-r--r--mysql-test/r/ctype_utf16.result27
-rw-r--r--mysql-test/r/ctype_utf16_uca.result46
-rw-r--r--mysql-test/r/ctype_utf32.result15
-rw-r--r--mysql-test/r/ctype_utf32_uca.result46
-rw-r--r--mysql-test/r/ctype_utf8.result162
-rw-r--r--mysql-test/r/ctype_utf8mb4_ndb.result1876
-rw-r--r--mysql-test/r/date_formats.result14
-rw-r--r--mysql-test/r/ddl_i18n_koi8r.result48
-rw-r--r--mysql-test/r/ddl_i18n_utf8.result48
-rw-r--r--mysql-test/r/delayed.result40
-rw-r--r--mysql-test/r/delete.result15
-rw-r--r--mysql-test/r/derived.result26
-rw-r--r--mysql-test/r/distinct.result11
-rw-r--r--mysql-test/r/errors.result12
-rw-r--r--mysql-test/r/events_1.result106
-rw-r--r--mysql-test/r/events_2.result46
-rw-r--r--mysql-test/r/events_bugs.result66
-rw-r--r--mysql-test/r/events_restart.result3
-rw-r--r--mysql-test/r/explain.result61
-rw-r--r--mysql-test/r/file_contents.result6
-rw-r--r--mysql-test/r/filesort_debug.result33
-rw-r--r--mysql-test/r/flush.result93
-rw-r--r--mysql-test/r/flush_read_lock.result1684
-rw-r--r--mysql-test/r/flush_read_lock_kill.result36
-rw-r--r--mysql-test/r/fulltext.result36
-rw-r--r--mysql-test/r/func_analyse.result26
-rw-r--r--mysql-test/r/func_encrypt_ucs2.result19
-rw-r--r--mysql-test/r/func_gconcat.result19
-rw-r--r--mysql-test/r/func_group.result58
-rw-r--r--mysql-test/r/func_group_innodb.result47
-rw-r--r--mysql-test/r/func_in.result6
-rw-r--r--mysql-test/r/func_like.result5
-rw-r--r--mysql-test/r/func_math.result99
-rw-r--r--mysql-test/r/func_misc.result44
-rw-r--r--mysql-test/r/func_set.result42
-rw-r--r--mysql-test/r/func_str.result28
-rw-r--r--mysql-test/r/func_time.result125
-rw-r--r--mysql-test/r/gis-rtree.result27
-rw-r--r--mysql-test/r/gis.result36
-rw-r--r--mysql-test/r/grant.result420
-rw-r--r--mysql-test/r/grant2.result4
-rw-r--r--mysql-test/r/grant3.result25
-rw-r--r--mysql-test/r/grant_cache_no_prot.result2
-rw-r--r--mysql-test/r/grant_cache_ps_prot.result2
-rw-r--r--mysql-test/r/group_by.result46
-rw-r--r--mysql-test/r/handler_innodb.result21
-rw-r--r--mysql-test/r/handler_myisam.result21
-rw-r--r--mysql-test/r/having.result22
-rw-r--r--mysql-test/r/implicit_char_to_num_conversion.result366
-rw-r--r--mysql-test/r/index_merge_myisam.result55
-rw-r--r--mysql-test/r/information_schema-big.result4
-rw-r--r--mysql-test/r/information_schema.result46
-rw-r--r--mysql-test/r/init_file.result1
-rw-r--r--mysql-test/r/innodb_mysql_lock.result24
-rw-r--r--mysql-test/r/innodb_mysql_sync.result120
-rw-r--r--mysql-test/r/insert_select.result2
-rw-r--r--mysql-test/r/ipv4_as_ipv6.result30
-rw-r--r--mysql-test/r/join_outer.result241
-rw-r--r--mysql-test/r/join_outer_innodb.result35
-rw-r--r--mysql-test/r/keywords.result224
-rw-r--r--mysql-test/r/kill.result274
-rw-r--r--mysql-test/r/loaddata.result16
-rw-r--r--mysql-test/r/lock_multi.result2
-rw-r--r--mysql-test/r/lock_sync.result69
-rw-r--r--mysql-test/r/log_tables.result10
-rw-r--r--mysql-test/r/log_tables_upgrade.result1
-rw-r--r--mysql-test/r/lowercase_fs_off.result8
-rw-r--r--mysql-test/r/lowercase_table2.result29
-rwxr-xr-xmysql-test/r/lowercase_table4.result115
-rw-r--r--mysql-test/r/mdl_sync.result61
-rw-r--r--mysql-test/r/merge.result104
-rw-r--r--mysql-test/r/metadata.result2
-rw-r--r--mysql-test/r/multi_update.result66
-rw-r--r--mysql-test/r/multi_update_innodb.result69
-rw-r--r--mysql-test/r/myisampack.result10
-rw-r--r--mysql-test/r/mysql.result69
-rw-r--r--mysql-test/r/mysql_embedded.result5
-rw-r--r--mysql-test/r/mysql_upgrade.result6
-rw-r--r--mysql-test/r/mysql_upgrade_ssl.result1
-rw-r--r--mysql-test/r/mysqladmin.result15
-rw-r--r--mysql-test/r/mysqlbinlog.result36
-rw-r--r--mysql-test/r/mysqlbinlog_base64.result10
-rw-r--r--mysql-test/r/mysqlbinlog_row_big.result8
-rw-r--r--mysql-test/r/mysqlcheck.result144
-rw-r--r--mysql-test/r/mysqld--defaults-file.result12
-rw-r--r--mysql-test/r/mysqld--help-notwin.result29
-rw-r--r--mysql-test/r/mysqld--help-win.result29
-rw-r--r--mysql-test/r/mysqldump.result106
-rw-r--r--mysql-test/r/mysqldump_restore.result10
-rw-r--r--mysql-test/r/mysqlslap.result22
-rw-r--r--mysql-test/r/mysqltest.result101
-rw-r--r--mysql-test/r/not_embedded_server.result45
-rw-r--r--mysql-test/r/openssl_1.result14
-rw-r--r--mysql-test/r/order_by.result29
-rw-r--r--mysql-test/r/packet.result1
-rw-r--r--mysql-test/r/partition.result172
-rw-r--r--mysql-test/r/partition_binlog.result49
-rw-r--r--mysql-test/r/partition_datatype.result1000
-rw-r--r--mysql-test/r/partition_debug_sync.result10
-rw-r--r--mysql-test/r/partition_error.result800
-rw-r--r--mysql-test/r/partition_innodb.result58
-rw-r--r--mysql-test/r/partition_innodb_plugin.result73
-rw-r--r--mysql-test/r/partition_myisam.result250
-rw-r--r--mysql-test/r/partition_not_embedded.result81
-rw-r--r--mysql-test/r/partition_range.result8
-rw-r--r--mysql-test/r/partition_symlink.result10
-rw-r--r--mysql-test/r/plugin_auth.result450
-rw-r--r--mysql-test/r/plugin_auth_qa.result327
-rw-r--r--mysql-test/r/plugin_auth_qa_1.result335
-rw-r--r--mysql-test/r/plugin_auth_qa_2.result150
-rw-r--r--mysql-test/r/plugin_auth_qa_3.result11
-rw-r--r--mysql-test/r/plugin_load_option.result7
-rw-r--r--mysql-test/r/plugin_not_embedded.result2
-rw-r--r--mysql-test/r/ps.result521
-rw-r--r--mysql-test/r/query_cache_28249.result6
-rw-r--r--mysql-test/r/query_cache_debug.result85
-rw-r--r--mysql-test/r/range.result101
-rw-r--r--mysql-test/r/rpl_mysqldump_slave.result9
-rw-r--r--mysql-test/r/select.result83
-rw-r--r--mysql-test/r/shm.result2
-rw-r--r--mysql-test/r/show_check.result38
-rw-r--r--mysql-test/r/signal.result7
-rw-r--r--mysql-test/r/signal_code.result16
-rw-r--r--mysql-test/r/sp-bugs.result36
-rw-r--r--mysql-test/r/sp-code.result4
-rw-r--r--mysql-test/r/sp-destruct.result19
-rw-r--r--mysql-test/r/sp-error.result91
-rw-r--r--mysql-test/r/sp-lock.result91
-rw-r--r--mysql-test/r/sp-security.result29
-rw-r--r--mysql-test/r/sp.result48
-rw-r--r--mysql-test/r/sp_notembedded.result27
-rw-r--r--mysql-test/r/sp_trans.result17
-rw-r--r--mysql-test/r/ssl_and_innodb.result8
-rw-r--r--mysql-test/r/ssl_cipher.result9
-rw-r--r--mysql-test/r/status.result6
-rw-r--r--mysql-test/r/status_bug17954.result13
-rw-r--r--mysql-test/r/subselect.result82
-rw-r--r--mysql-test/r/subselect4.result11
-rw-r--r--mysql-test/r/subselect_innodb.result9
-rw-r--r--mysql-test/r/symlink.result40
-rw-r--r--mysql-test/r/system_mysql_db.result5
-rw-r--r--mysql-test/r/tablespace.result112
-rw-r--r--mysql-test/r/trigger-compat.result95
-rw-r--r--mysql-test/r/trigger-trans.result5
-rw-r--r--mysql-test/r/trigger.result46
-rw-r--r--mysql-test/r/truncate_coverage.result27
-rw-r--r--mysql-test/r/type_blob.result10
-rw-r--r--mysql-test/r/type_date.result20
-rw-r--r--mysql-test/r/type_datetime.result69
-rw-r--r--mysql-test/r/type_newdecimal.result13
-rw-r--r--mysql-test/r/type_ranges.result2
-rw-r--r--mysql-test/r/type_timestamp.result92
-rw-r--r--mysql-test/r/type_year.result14
-rw-r--r--mysql-test/r/union.result125
-rw-r--r--mysql-test/r/user_var.result9
-rw-r--r--mysql-test/r/variables-big.result12
-rw-r--r--mysql-test/r/variables-notembedded.result24
-rw-r--r--mysql-test/r/variables.result77
-rw-r--r--mysql-test/r/variables_debug.result44
-rw-r--r--mysql-test/r/view.result24
-rw-r--r--mysql-test/r/view_grant.result126
-rw-r--r--mysql-test/r/warnings.result22
-rw-r--r--mysql-test/r/xa.result98
-rw-r--r--mysql-test/r/xml.result52
191 files changed, 15502 insertions, 2590 deletions
diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result
index ae9989ce563..792d9eaf2f1 100644
--- a/mysql-test/r/1st.result
+++ b/mysql-test/r/1st.result
@@ -21,6 +21,7 @@ ndb_binlog_index
plugin
proc
procs_priv
+proxies_priv
servers
slow_log
tables_priv
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 8ee24a86f10..723855867f3 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1290,3 +1290,24 @@ ALTER TABLE t1 CHANGE a id INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
+#
+# Bug#11754461 CANNOT ALTER TABLE WHEN KEY PREFIX TOO LONG
+#
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1 CHARACTER SET utf8;
+CREATE TABLE db1.t1 (bar TINYTEXT, KEY (bar(100)));
+ALTER TABLE db1.t1 ADD baz INT;
+DROP DATABASE db1;
+#
+# Bug#11938039 RE-EXECUTION OF FRM-ONLY ALTER TABLE WITH RENAME
+# CLAUSE FAILS OR ABORTS SERVER.
+#
+drop table if exists t1;
+create table t1 (a int);
+prepare stmt1 from 'alter table t1 alter column a set default 1, rename to t2';
+execute stmt1;
+rename table t2 to t1;
+# The below statement should succeed and not emit error or abort server.
+execute stmt1;
+deallocate prepare stmt1;
+drop table t2;
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index 0983e9fa8cf..a297622155b 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -12801,3 +12801,25 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
DROP TABLE t1;
+#
+# BUG#58205 - Valgrind failure in fn_format when called from
+# archive_discover
+#
+CREATE TABLE `a/../`(a INT) ENGINE=ARCHIVE;
+DROP TABLE `a/../`;
+#
+# BUG#57162 - valgrind errors, random data when returning
+# ordered data from archive tables
+#
+SET sort_buffer_size=32804;
+CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
+e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
+INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
+SELECT * FROM t1 ORDER BY f LIMIT 1;
+a b c d e f
+-1 b c d e 1
+DROP TABLE t1;
+SET sort_buffer_size=DEFAULT;
diff --git a/mysql-test/r/archive_debug.result b/mysql-test/r/archive_debug.result
new file mode 100644
index 00000000000..cc5a3761a99
--- /dev/null
+++ b/mysql-test/r/archive_debug.result
@@ -0,0 +1,12 @@
+#
+# BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
+# WITH PARTITIONED ARCHIVE TABLES
+#
+CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES(1);
+SET SESSION debug='d,simulate_archive_open_failure';
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check error Corrupt
+SET SESSION debug=DEFAULT;
+DROP TABLE t1;
diff --git a/mysql-test/r/archive_plugin.result b/mysql-test/r/archive_plugin.result
index 221b343cca5..90c1f10bf19 100644
--- a/mysql-test/r/archive_plugin.result
+++ b/mysql-test/r/archive_plugin.result
@@ -10,6 +10,9 @@ UNINSTALL PLUGIN archive;
INSTALL PLUGIN archive SONAME 'ha_archive.so';
CREATE TABLE t1(a int) ENGINE=ARCHIVE;
DROP TABLE t1;
+SELECT 1;
+1
+1
UNINSTALL PLUGIN archive;
UNINSTALL PLUGIN archive;
ERROR 42000: PLUGIN archive does not exist
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index dbeedb481cd..d21e78428c5 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -476,3 +476,43 @@ SELECT a FROM t2;
a
2
DROP TABLE t1, t2;
+#
+# Bug#39828 autoinc wraps around when offset and increment > 1
+#
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t1 VALUES (18446744073709551601);
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
+SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
+@@SESSION.AUTO_INCREMENT_OFFSET
+1
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+ERROR 22003: Out of range value for column 't1' at row 167
+SELECT * FROM t1;
+c1
+1
+18446744073709551601
+18446744073709551611
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=default;
+SET @@SESSION.AUTO_INCREMENT_OFFSET=default;
+DROP TABLE t1;
+End of 5.1 tests
+#
+# Bug#50619 assert in handler::update_auto_increment
+#
+CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk));
+INSERT INTO t1 VALUES (NULL), (-1), (NULL);
+SELECT * FROM t1;
+pk
+-1
+1
+2
+DROP TABLE t1;
+CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
+INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+SELECT * FROM t1;
+pk
+1
+18446744073709551614
+DROP TABLE t1;
diff --git a/mysql-test/r/blackhole_plugin.result b/mysql-test/r/blackhole_plugin.result
index 9fc0cacd9cc..4ef9fa0fa47 100644
--- a/mysql-test/r/blackhole_plugin.result
+++ b/mysql-test/r/blackhole_plugin.result
@@ -10,6 +10,9 @@ UNINSTALL PLUGIN blackhole;
INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so';
CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
DROP TABLE t1;
+SELECT 1;
+1
+1
UNINSTALL PLUGIN blackhole;
UNINSTALL PLUGIN blackhole;
ERROR 42000: PLUGIN blackhole does not exist
diff --git a/mysql-test/r/bootstrap.result b/mysql-test/r/bootstrap.result
index 3301ca74324..484724373d2 100644
--- a/mysql-test/r/bootstrap.result
+++ b/mysql-test/r/bootstrap.result
@@ -6,3 +6,15 @@ set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
drop table t1;
+End of 5.1 tests
+#
+# Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
+# STARTED WITH --SKIP-INNODB
+#
+SHOW VARIABLES LIKE 'have_innodb';
+Variable_name Value
+have_innodb DISABLED
+SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb';
+SUPPORT
+NO
+End of 5.5 tests
diff --git a/mysql-test/r/bug58669.result b/mysql-test/r/bug58669.result
new file mode 100644
index 00000000000..5504c5908be
--- /dev/null
+++ b/mysql-test/r/bug58669.result
@@ -0,0 +1,17 @@
+#
+# Bug#58669: read_only not enforced on 5.5.x
+#
+CREATE USER user1@localhost;
+CREATE DATABASE db1;
+GRANT ALL PRIVILEGES ON db1.* TO user1@localhost;
+CREATE TABLE db1.t1(a INT);
+SELECT CURRENT_USER();
+CURRENT_USER()
+user1@localhost
+SHOW VARIABLES LIKE "%read_only%";
+Variable_name Value
+read_only ON
+INSERT INTO db1.t1 VALUES (1);
+ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+DROP DATABASE db1;
+DROP USER user1@localhost;
diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result
index 600ed84c3c9..293d7a3f412 100644
--- a/mysql-test/r/cache_innodb.result
+++ b/mysql-test/r/cache_innodb.result
@@ -220,3 +220,14 @@ Variable_name Value
Qcache_hits 1
set GLOBAL query_cache_size=1048576;
drop table t2;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES(1);
+ROLLBACK WORK AND CHAIN NO RELEASE;
+SELECT a FROM t1;
+a
+ROLLBACK WORK AND CHAIN NO RELEASE;
+SELECT a FROM t1;
+a
+ROLLBACK;
+DROP TABLE t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 3e1ea824db5..89cbda9847c 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -451,4 +451,21 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
1
1
DROP TABLE t1;
+#
+# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
+# DOESN'T ADHERE TO MAX_ALLOWED_PACKET
+SET @@GLOBAL.max_allowed_packet=2048;
+Warnings:
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+SELECT CONVERT('a', BINARY(2049));
+CONVERT('a', BINARY(2049))
+NULL
+Warnings:
+Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (2048) - truncated
+SELECT CONVERT('a', CHAR(2049));
+CONVERT('a', CHAR(2049))
+NULL
+Warnings:
+Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
+SET @@GLOBAL.max_allowed_packet=default;
End of 5.1 tests
diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result
index 0bff34dba20..ac9c7bca9d7 100644
--- a/mysql-test/r/check.result
+++ b/mysql-test/r/check.result
@@ -23,3 +23,19 @@ REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
DROP TABLE t1;
+#
+# Bug#56422 CHECK TABLE run when the table is locked reports corruption
+# along with timeout
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+LOCK TABLE t1 WRITE;
+# Connection con1
+SET lock_wait_timeout= 1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Lock wait timeout exceeded; try restarting transaction
+test.t1 check status Operation failed
+# Connection default
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result
index aa4bdb2bd61..7f74a092af7 100644
--- a/mysql-test/r/client_xml.result
+++ b/mysql-test/r/client_xml.result
@@ -21,9 +21,9 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" />
- <field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" />
- <field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" />
+ <field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index 993d33d7a38..fb1552b6c28 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -519,21 +519,21 @@ SUCCESS
# 12. Read-write statement: IODKU, change 0 rows.
#
insert t1 set a=2 on duplicate key update a=2;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
SUCCESS
commit;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
SUCCESS
# 13. Read-write statement: INSERT IGNORE, change 0 rows.
#
insert ignore t1 set a=2;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
SUCCESS
commit;
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(2, 2, 1, 0);
SUCCESS
# 14. Read-write statement: INSERT IGNORE, change 1 row.
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index 690a6fb3bc3..cff54ebef4e 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -15,6 +15,7 @@ ndb_binlog_index
plugin
proc
procs_priv
+proxies_priv
servers
slow_log
tables_priv
@@ -48,6 +49,7 @@ ndb_binlog_index
plugin
proc
procs_priv
+proxies_priv
servers
slow_log
tables_priv
@@ -89,6 +91,7 @@ ndb_binlog_index
plugin
proc
procs_priv
+proxies_priv
servers
slow_log
tables_priv
diff --git a/mysql-test/r/csv_not_null.result b/mysql-test/r/csv_not_null.result
index af583a36837..aed9bcb1587 100644
--- a/mysql-test/r/csv_not_null.result
+++ b/mysql-test/r/csv_not_null.result
@@ -19,13 +19,16 @@ INSERT INTO t1 VALUES();
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
+INSERT INTO t1 VALUES(default,default,default,default,default,default);
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
+0 foo 0000-00-00
INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
+0 foo 0000-00-00
0 abc def ghi bar 1999-12-31
# === insert failures ===
INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 4eab57e4d81..a9977311640 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -1426,7 +1426,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(10) NOT NULL DEFAULT ''
+ `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -2047,7 +2047,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varbinary(2) DEFAULT NULL
+ `concat(a)` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a year);
@@ -2356,7 +2356,7 @@ insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varbinary(2) YES NULL
+a varbinary(4) YES NULL
select hex(a) from v1;
hex(a)
3031
@@ -2749,6 +2749,91 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+binary
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
+# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection @@character_set_results
+binary binary
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `field_str1` varbinary(29) DEFAULT NULL,
+ `field1_str2` varbinary(29) DEFAULT NULL,
+ `field_date` date DEFAULT NULL,
+ `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def field_str1 254 29 10 Y 128 31 63
+def field1_str2 254 29 19 Y 128 31 63
+def field_date 10 29 10 Y 128 31 63
+def field_datetime 12 29 19 Y 128 31 63
+field_str1 field1_str2 field_date field_datetime
+2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1 field1_str2 field_date field_datetime
+323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
+#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+binary
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result
index 7f0cdf3f17b..231755a3f69 100644
--- a/mysql-test/r/ctype_cp1250_ch.result
+++ b/mysql-test/r/ctype_cp1250_ch.result
@@ -238,3 +238,6 @@ select a from t1 where a like "abcdefghá";
a
abcdefghá
drop table t1;
+set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators)
+using cp1250);
+ERROR HY000: Unknown locale: '1'
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index a9ced3e89bf..53b45d60c0b 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -82,6 +82,316 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
DROP TABLE t1;
#
+# Start of 5.1 tests
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0;
+INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
+INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
+INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
+INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
+INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
+INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
+INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
+INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
+INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
+INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
+INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
+INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
+INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
+INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
+INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
+INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
+INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
+INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
+INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
+INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
+INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
+INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
+INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
+INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
+SELECT
+HEX(a) AS chr,
+HEX(LOWER(a)) AS upper,
+HEX(LOWER(a)) AS lower,
+HEX(@utf8:=CONVERT(a USING utf8)) AS utf8,
+HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip,
+if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe
+FROM t1 ORDER BY chr;
+chr upper lower utf8 roundtrip issafe
+00 00 00 00 00
+01 01 01 01 01
+02 02 02 02 02
+03 03 03 03 03
+04 04 04 04 04
+05 05 05 05 05
+06 06 06 06 06
+07 07 07 07 07
+08 08 08 08 08
+09 09 09 09 09
+0A 0A 0A 0A 0A
+0B 0B 0B 0B 0B
+0C 0C 0C 0C 0C
+0D 0D 0D 0D 0D
+0E 0E 0E 0E 0E
+0F 0F 0F 0F 0F
+10 10 10 10 10
+11 11 11 11 11
+12 12 12 12 12
+13 13 13 13 13
+14 14 14 14 14
+15 15 15 15 15
+16 16 16 16 16
+17 17 17 17 17
+18 18 18 18 18
+19 19 19 19 19
+1A 1A 1A 1A 1A
+1B 1B 1B 1B 1B
+1C 1C 1C 1C 1C
+1D 1D 1D 1D 1D
+1E 1E 1E 1E 1E
+1F 1F 1F 1F 1F
+20 20 20 20 20
+21 21 21 21 21
+22 22 22 22 22
+23 23 23 23 23
+24 24 24 24 24
+25 25 25 25 25
+26 26 26 26 26
+27 27 27 27 27
+28 28 28 28 28
+29 29 29 29 29
+2A 2A 2A 2A 2A
+2B 2B 2B 2B 2B
+2C 2C 2C 2C 2C
+2D 2D 2D 2D 2D
+2E 2E 2E 2E 2E
+2F 2F 2F 2F 2F
+30 30 30 30 30
+31 31 31 31 31
+32 32 32 32 32
+33 33 33 33 33
+34 34 34 34 34
+35 35 35 35 35
+36 36 36 36 36
+37 37 37 37 37
+38 38 38 38 38
+39 39 39 39 39
+3A 3A 3A 3A 3A
+3B 3B 3B 3B 3B
+3C 3C 3C 3C 3C
+3D 3D 3D 3D 3D
+3E 3E 3E 3E 3E
+3F 3F 3F 3F 3F
+40 40 40 40 40
+41 61 61 41 41
+42 62 62 42 42
+43 63 63 43 43
+44 64 64 44 44
+45 65 65 45 45
+46 66 66 46 46
+47 67 67 47 47
+48 68 68 48 48
+49 69 69 49 49
+4A 6A 6A 4A 4A
+4B 6B 6B 4B 4B
+4C 6C 6C 4C 4C
+4D 6D 6D 4D 4D
+4E 6E 6E 4E 4E
+4F 6F 6F 4F 4F
+50 70 70 50 50
+51 71 71 51 51
+52 72 72 52 52
+53 73 73 53 53
+54 74 74 54 54
+55 75 75 55 55
+56 76 76 56 56
+57 77 77 57 57
+58 78 78 58 58
+59 79 79 59 59
+5A 7A 7A 5A 5A
+5B 5B 5B 5B 5B
+5C 5C 5C 5C 5C
+5D 5D 5D 5D 5D
+5E 5E 5E 5E 5E
+5F 5F 5F 5F 5F
+60 60 60 60 60
+61 61 61 61 61
+62 62 62 62 62
+63 63 63 63 63
+64 64 64 64 64
+65 65 65 65 65
+66 66 66 66 66
+67 67 67 67 67
+68 68 68 68 68
+69 69 69 69 69
+6A 6A 6A 6A 6A
+6B 6B 6B 6B 6B
+6C 6C 6C 6C 6C
+6D 6D 6D 6D 6D
+6E 6E 6E 6E 6E
+6F 6F 6F 6F 6F
+70 70 70 70 70
+71 71 71 71 71
+72 72 72 72 72
+73 73 73 73 73
+74 74 74 74 74
+75 75 75 75 75
+76 76 76 76 76
+77 77 77 77 77
+78 78 78 78 78
+79 79 79 79 79
+7A 7A 7A 7A 7A
+7B 7B 7B 7B 7B
+7C 7C 7C 7C 7C
+7D 7D 7D 7D 7D
+7E 7E 7E 7E 7E
+7F 7F 7F 7F 7F
+80 90 90 D082 80
+81 83 83 D083 81
+82 82 82 E2809A 82
+83 83 83 D193 83
+84 84 84 E2809E 84
+85 85 85 E280A6 85
+86 86 86 E280A0 86
+87 87 87 E280A1 87
+88 88 88 E282AC 88
+89 89 89 E280B0 89
+8A 9A 9A D089 8A
+8B 8B 8B E280B9 8B
+8C 9C 9C D08A 8C
+8D 9D 9D D08C 8D
+8E 9E 9E D08B 8E
+8F 9F 9F D08F 8F
+90 90 90 D192 90
+91 91 91 E28098 91
+92 92 92 E28099 92
+93 93 93 E2809C 93
+94 94 94 E2809D 94
+95 95 95 E280A2 95
+96 96 96 E28093 96
+97 97 97 E28094 97
+98 98 98 3F 3F Round trip unsafe
+99 99 99 E284A2 99
+9A 9A 9A D199 9A
+9B 9B 9B E280BA 9B
+9C 9C 9C D19A 9C
+9D 9D 9D D19C 9D
+9E 9E 9E D19B 9E
+9F 9F 9F D19F 9F
+A0 A0 A0 C2A0 A0
+A1 A2 A2 D08E A1
+A2 A2 A2 D19E A2
+A3 BC BC D088 A3
+A4 A4 A4 C2A4 A4
+A5 B4 B4 D290 A5
+A6 A6 A6 C2A6 A6
+A7 A7 A7 C2A7 A7
+A8 B8 B8 D081 A8
+A9 A9 A9 C2A9 A9
+AA BA BA D084 AA
+AB AB AB C2AB AB
+AC AC AC C2AC AC
+AD AD AD C2AD AD
+AE AE AE C2AE AE
+AF BF BF D087 AF
+B0 B0 B0 C2B0 B0
+B1 B1 B1 C2B1 B1
+B2 B3 B3 D086 B2
+B3 B3 B3 D196 B3
+B4 B4 B4 D291 B4
+B5 B5 B5 C2B5 B5
+B6 B6 B6 C2B6 B6
+B7 B7 B7 C2B7 B7
+B8 B8 B8 D191 B8
+B9 B9 B9 E28496 B9
+BA BA BA D194 BA
+BB BB BB C2BB BB
+BC BC BC D198 BC
+BD BE BE D085 BD
+BE BE BE D195 BE
+BF BF BF D197 BF
+C0 E0 E0 D090 C0
+C1 E1 E1 D091 C1
+C2 E2 E2 D092 C2
+C3 E3 E3 D093 C3
+C4 E4 E4 D094 C4
+C5 E5 E5 D095 C5
+C6 E6 E6 D096 C6
+C7 E7 E7 D097 C7
+C8 E8 E8 D098 C8
+C9 E9 E9 D099 C9
+CA EA EA D09A CA
+CB EB EB D09B CB
+CC EC EC D09C CC
+CD ED ED D09D CD
+CE EE EE D09E CE
+CF EF EF D09F CF
+D0 F0 F0 D0A0 D0
+D1 F1 F1 D0A1 D1
+D2 F2 F2 D0A2 D2
+D3 F3 F3 D0A3 D3
+D4 F4 F4 D0A4 D4
+D5 F5 F5 D0A5 D5
+D6 F6 F6 D0A6 D6
+D7 F7 F7 D0A7 D7
+D8 F8 F8 D0A8 D8
+D9 F9 F9 D0A9 D9
+DA FA FA D0AA DA
+DB FB FB D0AB DB
+DC FC FC D0AC DC
+DD FD FD D0AD DD
+DE FE FE D0AE DE
+DF FF FF D0AF DF
+E0 E0 E0 D0B0 E0
+E1 E1 E1 D0B1 E1
+E2 E2 E2 D0B2 E2
+E3 E3 E3 D0B3 E3
+E4 E4 E4 D0B4 E4
+E5 E5 E5 D0B5 E5
+E6 E6 E6 D0B6 E6
+E7 E7 E7 D0B7 E7
+E8 E8 E8 D0B8 E8
+E9 E9 E9 D0B9 E9
+EA EA EA D0BA EA
+EB EB EB D0BB EB
+EC EC EC D0BC EC
+ED ED ED D0BD ED
+EE EE EE D0BE EE
+EF EF EF D0BF EF
+F0 F0 F0 D180 F0
+F1 F1 F1 D181 F1
+F2 F2 F2 D182 F2
+F3 F3 F3 D183 F3
+F4 F4 F4 D184 F4
+F5 F5 F5 D185 F5
+F6 F6 F6 D186 F6
+F7 F7 F7 D187 F7
+F8 F8 F8 D188 F8
+F9 F9 F9 D189 F9
+FA FA FA D18A FA
+FB FB FB D18B FB
+FC FC FC D18C FC
+FD FD FD D18D FD
+FE FE FE D18E FE
+FF FF FF D18F FF
+DROP TABLE t1;
+set global LC_TIME_NAMES=convert((-8388608) using cp1251);
+ERROR HY000: Unknown locale: '-8388608'
+#
+# End of 5.1 tests
+#
+#
# Start of 5.5 tests
#
SET TIME_ZONE = _latin1 '+03:00';
@@ -1508,7 +1818,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+ `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -2129,7 +2439,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
+ `concat(a)` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a year);
@@ -2438,7 +2748,7 @@ insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(2) YES NULL
+a varchar(4) YES NULL
select hex(a) from v1;
hex(a)
3031
@@ -2831,6 +3141,91 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
+# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection @@character_set_results
+cp1251_general_ci cp1251
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `field_str1` varchar(29) CHARACTER SET cp1251 DEFAULT NULL,
+ `field1_str2` varchar(29) CHARACTER SET cp1251 DEFAULT NULL,
+ `field_date` date DEFAULT NULL,
+ `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def field_str1 254 29 10 Y 0 31 51
+def field1_str2 254 29 19 Y 0 31 51
+def field_date 10 29 10 Y 128 31 63
+def field_datetime 12 29 19 Y 128 31 63
+field_str1 field1_str2 field_date field_datetime
+2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1 field1_str2 field_date field_datetime
+323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
+#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
@@ -2851,5 +3246,20 @@ maketime(`a`,`a`,`a`)
DROP TABLE t1;
SET sql_mode=default;
#
+# Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations
+#
+CREATE TABLE t1 (test1 INT, test2 VARCHAR(255));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `test1` int(11) DEFAULT NULL,
+ `test2` varchar(255) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1;
+COALESCE(IF(test1=1, 1, NULL), test2)
+SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1;
+COALESCE(IF(test1=1, NULL, 1), test2)
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result
index bd25b1beed4..5a402d57e65 100644
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
@@ -9859,6 +9859,8 @@ hex(convert(_eucjpms 0xA5FE41 using ucs2))
select hex(convert(_eucjpms 0x8FABF841 using ucs2));
hex(convert(_eucjpms 0x8FABF841 using ucs2))
003F0041
+set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8);
+ERROR HY000: Unknown locale: 'c'
#
# Start of 5.5 tests
#
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index b97e6e695af..61560bd25e6 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -410,6 +410,15 @@ hex(cast(_ascii 0x7f as char(1) character set latin1))
7F
End of 5.0 tests
#
+# Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings
+#
+SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '');
+'' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '')
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+End of 5.1 tests
+#
# Start of 5.5 tests
#
SET TIME_ZONE = _latin1 '+03:00';
@@ -1836,7 +1845,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) NOT NULL DEFAULT ''
+ `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -2457,7 +2466,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(2) DEFAULT NULL
+ `concat(a)` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a year);
@@ -2766,7 +2775,7 @@ insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(2) YES NULL
+a varchar(4) YES NULL
select hex(a) from v1;
hex(a)
3031
@@ -3159,6 +3168,91 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
+# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection @@character_set_results
+latin1_swedish_ci latin1
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `field_str1` varchar(29) DEFAULT NULL,
+ `field1_str2` varchar(29) DEFAULT NULL,
+ `field_date` date DEFAULT NULL,
+ `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def field_str1 254 29 10 Y 0 31 8
+def field1_str2 254 29 19 Y 0 31 8
+def field_date 10 29 10 Y 128 31 63
+def field_datetime 12 29 19 Y 128 31 63
+field_str1 field1_str2 field_date field_datetime
+2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1 field1_str2 field_date field_datetime
+323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
+#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
@@ -3179,5 +3273,20 @@ maketime(`a`,`a`,`a`)
DROP TABLE t1;
SET sql_mode=default;
#
+# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
+#
+SET NAMES utf8;
+EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8'abcd\xC3\xB3' AS `abcdó`
+SET NAMES latin1;
+EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8'abcd\xC3\xB3' AS `abcdó`
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_like_range.result b/mysql-test/r/ctype_like_range.result
new file mode 100644
index 00000000000..a06c6ad9ed8
--- /dev/null
+++ b/mysql-test/r/ctype_like_range.result
@@ -0,0 +1,2310 @@
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, a VARBINARY(32));
+INSERT INTO t1 (a) VALUES (''),('_'),('%'),('\_'),('\%'),('\\');
+INSERT INTO t1 (a) VALUES ('a'),('c');
+INSERT INTO t1 (a) VALUES ('a_'),('c_');
+INSERT INTO t1 (a) VALUES ('a%'),('c%');
+INSERT INTO t1 (a) VALUES ('aa'),('cc'),('ch');
+INSERT INTO t1 (a) VALUES ('aa_'),('cc_'),('ch_');
+INSERT INTO t1 (a) VALUES ('aa%'),('cc%'),('ch%');
+INSERT INTO t1 (a) VALUES ('aaa'),('ccc'),('cch');
+INSERT INTO t1 (a) VALUES ('aaa_'),('ccc_'),('cch_');
+INSERT INTO t1 (a) VALUES ('aaa%'),('ccc%'),('cch%');
+INSERT INTO t1 (a) VALUES ('aaaaaaaaaaaaaaaaaaaa');
+CREATE VIEW v1 AS
+SELECT id, 'a' AS name, a AS val FROM t1
+UNION
+SELECT id, 'mn', HEX(LIKE_RANGE_MIN(a, 16)) AS min FROM t1
+UNION
+SELECT id, 'mx', HEX(LIKE_RANGE_MAX(a, 16)) AS max FROM t1
+UNION
+SELECT id, 'sp', REPEAT('-', 32) AS sep FROM t1
+ORDER BY id, name;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00
+2 mx FF
+2 sp --------------------------------
+3 a %
+3 mn
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 5F
+4 mx 5F
+4 sp --------------------------------
+5 a \%
+5 mn 25
+5 mx 25
+5 sp --------------------------------
+6 a \
+6 mn 5C
+6 mx 5C
+6 sp --------------------------------
+7 a a
+7 mn 61
+7 mx 61
+7 sp --------------------------------
+8 a c
+8 mn 63
+8 mx 63
+8 sp --------------------------------
+9 a a_
+9 mn 6100
+9 mx 61FF
+9 sp --------------------------------
+10 a c_
+10 mn 6300
+10 mx 63FF
+10 sp --------------------------------
+11 a a%
+11 mn 61
+11 mx 61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 63
+12 mx 63FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 6161
+13 mx 6161
+13 sp --------------------------------
+14 a cc
+14 mn 6363
+14 mx 6363
+14 sp --------------------------------
+15 a ch
+15 mn 6368
+15 mx 6368
+15 sp --------------------------------
+16 a aa_
+16 mn 616100
+16 mx 6161FF
+16 sp --------------------------------
+17 a cc_
+17 mn 636300
+17 mx 6363FF
+17 sp --------------------------------
+18 a ch_
+18 mn 636800
+18 mx 6368FF
+18 sp --------------------------------
+19 a aa%
+19 mn 6161
+19 mx 6161FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 6363
+20 mx 6363FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 6368
+21 mx 6368FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 616161
+22 mx 616161
+22 sp --------------------------------
+23 a ccc
+23 mn 636363
+23 mx 636363
+23 sp --------------------------------
+24 a cch
+24 mn 636368
+24 mx 636368
+24 sp --------------------------------
+25 a aaa_
+25 mn 61616100
+25 mx 616161FF
+25 sp --------------------------------
+26 a ccc_
+26 mn 63636300
+26 mx 636363FF
+26 sp --------------------------------
+27 a cch_
+27 mn 63636800
+27 mx 636368FF
+27 sp --------------------------------
+28 a aaa%
+28 mn 616161
+28 mx 616161FFFFFFFFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 636363
+29 mx 636363FFFFFFFFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 636368
+30 mx 636368FFFFFFFFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 61616161616161616161616161616161
+31 mx 61616161616161616161616161616161
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET latin1;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00
+2 mx FF
+2 sp --------------------------------
+3 a %
+3 mn 00000000000000000000000000000000
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 5F
+4 mx 5F
+4 sp --------------------------------
+5 a \%
+5 mn 25
+5 mx 25
+5 sp --------------------------------
+6 a \
+6 mn 5C
+6 mx 5C
+6 sp --------------------------------
+7 a a
+7 mn 61
+7 mx 61
+7 sp --------------------------------
+8 a c
+8 mn 63
+8 mx 63
+8 sp --------------------------------
+9 a a_
+9 mn 6100
+9 mx 61FF
+9 sp --------------------------------
+10 a c_
+10 mn 6300
+10 mx 63FF
+10 sp --------------------------------
+11 a a%
+11 mn 61000000000000000000000000000000
+11 mx 61FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 63000000000000000000000000000000
+12 mx 63FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 6161
+13 mx 6161
+13 sp --------------------------------
+14 a cc
+14 mn 6363
+14 mx 6363
+14 sp --------------------------------
+15 a ch
+15 mn 6368
+15 mx 6368
+15 sp --------------------------------
+16 a aa_
+16 mn 616100
+16 mx 6161FF
+16 sp --------------------------------
+17 a cc_
+17 mn 636300
+17 mx 6363FF
+17 sp --------------------------------
+18 a ch_
+18 mn 636800
+18 mx 6368FF
+18 sp --------------------------------
+19 a aa%
+19 mn 61610000000000000000000000000000
+19 mx 6161FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 63630000000000000000000000000000
+20 mx 6363FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 63680000000000000000000000000000
+21 mx 6368FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 616161
+22 mx 616161
+22 sp --------------------------------
+23 a ccc
+23 mn 636363
+23 mx 636363
+23 sp --------------------------------
+24 a cch
+24 mn 636368
+24 mx 636368
+24 sp --------------------------------
+25 a aaa_
+25 mn 61616100
+25 mx 616161FF
+25 sp --------------------------------
+26 a ccc_
+26 mn 63636300
+26 mx 636363FF
+26 sp --------------------------------
+27 a cch_
+27 mn 63636800
+27 mx 636368FF
+27 sp --------------------------------
+28 a aaa%
+28 mn 61616100000000000000000000000000
+28 mx 616161FFFFFFFFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 63636300000000000000000000000000
+29 mx 636363FFFFFFFFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 63636800000000000000000000000000
+30 mx 636368FFFFFFFFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 61616161616161616161616161616161
+31 mx 61616161616161616161616161616161
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00000000000000000000000000000000
+2 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+2 sp --------------------------------
+3 a %
+3 mn 00000000000000000000000000000000
+3 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+3 sp --------------------------------
+4 a \_
+4 mn 5F
+4 mx 5F
+4 sp --------------------------------
+5 a \%
+5 mn 25
+5 mx 25
+5 sp --------------------------------
+6 a \
+6 mn 5C
+6 mx 5C
+6 sp --------------------------------
+7 a a
+7 mn 61
+7 mx 61
+7 sp --------------------------------
+8 a c
+8 mn 63
+8 mx 63
+8 sp --------------------------------
+9 a a_
+9 mn 61000000000000000000000000000000
+9 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+9 sp --------------------------------
+10 a c_
+10 mn 63000000000000000000000000000000
+10 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+10 sp --------------------------------
+11 a a%
+11 mn 61000000000000000000000000000000
+11 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+11 sp --------------------------------
+12 a c%
+12 mn 63000000000000000000000000000000
+12 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+12 sp --------------------------------
+13 a aa
+13 mn 6161
+13 mx 6161
+13 sp --------------------------------
+14 a cc
+14 mn 6363
+14 mx 6363
+14 sp --------------------------------
+15 a ch
+15 mn 6368
+15 mx 6368
+15 sp --------------------------------
+16 a aa_
+16 mn 61610000000000000000000000000000
+16 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+16 sp --------------------------------
+17 a cc_
+17 mn 63630000000000000000000000000000
+17 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+17 sp --------------------------------
+18 a ch_
+18 mn 63680000000000000000000000000000
+18 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+18 sp --------------------------------
+19 a aa%
+19 mn 61610000000000000000000000000000
+19 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+19 sp --------------------------------
+20 a cc%
+20 mn 63630000000000000000000000000000
+20 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+20 sp --------------------------------
+21 a ch%
+21 mn 63680000000000000000000000000000
+21 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+21 sp --------------------------------
+22 a aaa
+22 mn 616161
+22 mx 616161
+22 sp --------------------------------
+23 a ccc
+23 mn 636363
+23 mx 636363
+23 sp --------------------------------
+24 a cch
+24 mn 636368
+24 mx 636368
+24 sp --------------------------------
+25 a aaa_
+25 mn 61616100000000000000000000000000
+25 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20
+25 sp --------------------------------
+26 a ccc_
+26 mn 63636300000000000000000000000000
+26 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20
+26 sp --------------------------------
+27 a cch_
+27 mn 63636800000000000000000000000000
+27 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+27 sp --------------------------------
+28 a aaa%
+28 mn 61616100000000000000000000000000
+28 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20
+28 sp --------------------------------
+29 a ccc%
+29 mn 63636300000000000000000000000000
+29 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20
+29 sp --------------------------------
+30 a cch%
+30 mn 63636800000000000000000000000000
+30 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 6161616161
+31 mx 6161616161
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 09090909090909090909090909090909
+2 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+2 sp --------------------------------
+3 a %
+3 mn 09090909090909090909090909090909
+3 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+3 sp --------------------------------
+4 a \_
+4 mn 5F
+4 mx 5F
+4 sp --------------------------------
+5 a \%
+5 mn 25
+5 mx 25
+5 sp --------------------------------
+6 a \
+6 mn 5C
+6 mx 5C
+6 sp --------------------------------
+7 a a
+7 mn 61
+7 mx 61
+7 sp --------------------------------
+8 a c
+8 mn 63
+8 mx 63
+8 sp --------------------------------
+9 a a_
+9 mn 61090909090909090909090909090909
+9 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+9 sp --------------------------------
+10 a c_
+10 mn 63090909090909090909090909090909
+10 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+10 sp --------------------------------
+11 a a%
+11 mn 61090909090909090909090909090909
+11 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+11 sp --------------------------------
+12 a c%
+12 mn 63090909090909090909090909090909
+12 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+12 sp --------------------------------
+13 a aa
+13 mn 6161
+13 mx 6161
+13 sp --------------------------------
+14 a cc
+14 mn 6363
+14 mx 6363
+14 sp --------------------------------
+15 a ch
+15 mn 6368
+15 mx 6368
+15 sp --------------------------------
+16 a aa_
+16 mn 61610909090909090909090909090909
+16 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+16 sp --------------------------------
+17 a cc_
+17 mn 63630909090909090909090909090909
+17 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+17 sp --------------------------------
+18 a ch_
+18 mn 63680909090909090909090909090909
+18 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+18 sp --------------------------------
+19 a aa%
+19 mn 61610909090909090909090909090909
+19 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+19 sp --------------------------------
+20 a cc%
+20 mn 63630909090909090909090909090909
+20 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+20 sp --------------------------------
+21 a ch%
+21 mn 63680909090909090909090909090909
+21 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+21 sp --------------------------------
+22 a aaa
+22 mn 616161
+22 mx 616161
+22 sp --------------------------------
+23 a ccc
+23 mn 636363
+23 mx 636363
+23 sp --------------------------------
+24 a cch
+24 mn 636368
+24 mx 636368
+24 sp --------------------------------
+25 a aaa_
+25 mn 61616109090909090909090909090909
+25 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20
+25 sp --------------------------------
+26 a ccc_
+26 mn 63636309090909090909090909090909
+26 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20
+26 sp --------------------------------
+27 a cch_
+27 mn 63636809090909090909090909090909
+27 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+27 sp --------------------------------
+28 a aaa%
+28 mn 61616109090909090909090909090909
+28 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20
+28 sp --------------------------------
+29 a ccc%
+29 mn 63636309090909090909090909090909
+29 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20
+29 sp --------------------------------
+30 a cch%
+30 mn 63636809090909090909090909090909
+30 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 6161616161
+31 mx 6161616161
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_czech_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 09090909090909090909090909090909
+2 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+2 sp --------------------------------
+3 a %
+3 mn 09090909090909090909090909090909
+3 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+3 sp --------------------------------
+4 a \_
+4 mn 5F
+4 mx 5F
+4 sp --------------------------------
+5 a \%
+5 mn 25
+5 mx 25
+5 sp --------------------------------
+6 a \
+6 mn 5C
+6 mx 5C
+6 sp --------------------------------
+7 a a
+7 mn 61
+7 mx 61
+7 sp --------------------------------
+8 a c
+8 mn 63
+8 mx 63
+8 sp --------------------------------
+9 a a_
+9 mn 61090909090909090909090909090909
+9 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+9 sp --------------------------------
+10 a c_
+10 mn 09090909090909090909090909090909
+10 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+10 sp --------------------------------
+11 a a%
+11 mn 61090909090909090909090909090909
+11 mx 61EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+11 sp --------------------------------
+12 a c%
+12 mn 09090909090909090909090909090909
+12 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+12 sp --------------------------------
+13 a aa
+13 mn 6161
+13 mx 6161
+13 sp --------------------------------
+14 a cc
+14 mn 6363
+14 mx 6363
+14 sp --------------------------------
+15 a ch
+15 mn 6368
+15 mx 6368
+15 sp --------------------------------
+16 a aa_
+16 mn 61610909090909090909090909090909
+16 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+16 sp --------------------------------
+17 a cc_
+17 mn 63090909090909090909090909090909
+17 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+17 sp --------------------------------
+18 a ch_
+18 mn 63680909090909090909090909090909
+18 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+18 sp --------------------------------
+19 a aa%
+19 mn 61610909090909090909090909090909
+19 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+19 sp --------------------------------
+20 a cc%
+20 mn 63090909090909090909090909090909
+20 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+20 sp --------------------------------
+21 a ch%
+21 mn 63680909090909090909090909090909
+21 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+21 sp --------------------------------
+22 a aaa
+22 mn 616161
+22 mx 616161
+22 sp --------------------------------
+23 a ccc
+23 mn 636363
+23 mx 636363
+23 sp --------------------------------
+24 a cch
+24 mn 636368
+24 mx 636368
+24 sp --------------------------------
+25 a aaa_
+25 mn 61616109090909090909090909090909
+25 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20
+25 sp --------------------------------
+26 a ccc_
+26 mn 63630909090909090909090909090909
+26 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+26 sp --------------------------------
+27 a cch_
+27 mn 63636809090909090909090909090909
+27 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+27 sp --------------------------------
+28 a aaa%
+28 mn 61616109090909090909090909090909
+28 mx 616161EFBFBFEFBFBFEFBFBFEFBFBF20
+28 sp --------------------------------
+29 a ccc%
+29 mn 63630909090909090909090909090909
+29 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+29 sp --------------------------------
+30 a cch%
+30 mn 63636809090909090909090909090909
+30 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 6161616161
+31 mx 6161616161
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_danish_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 09090909090909090909090909090909
+2 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+2 sp --------------------------------
+3 a %
+3 mn 09090909090909090909090909090909
+3 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+3 sp --------------------------------
+4 a \_
+4 mn 5F
+4 mx 5F
+4 sp --------------------------------
+5 a \%
+5 mn 25
+5 mx 25
+5 sp --------------------------------
+6 a \
+6 mn 5C
+6 mx 5C
+6 sp --------------------------------
+7 a a
+7 mn 61
+7 mx 61
+7 sp --------------------------------
+8 a c
+8 mn 63
+8 mx 63
+8 sp --------------------------------
+9 a a_
+9 mn 09090909090909090909090909090909
+9 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+9 sp --------------------------------
+10 a c_
+10 mn 63090909090909090909090909090909
+10 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+10 sp --------------------------------
+11 a a%
+11 mn 09090909090909090909090909090909
+11 mx EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF20
+11 sp --------------------------------
+12 a c%
+12 mn 63090909090909090909090909090909
+12 mx 63EFBFBFEFBFBFEFBFBFEFBFBFEFBFBF
+12 sp --------------------------------
+13 a aa
+13 mn 6161
+13 mx 6161
+13 sp --------------------------------
+14 a cc
+14 mn 6363
+14 mx 6363
+14 sp --------------------------------
+15 a ch
+15 mn 6368
+15 mx 6368
+15 sp --------------------------------
+16 a aa_
+16 mn 61610909090909090909090909090909
+16 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+16 sp --------------------------------
+17 a cc_
+17 mn 63630909090909090909090909090909
+17 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+17 sp --------------------------------
+18 a ch_
+18 mn 63680909090909090909090909090909
+18 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+18 sp --------------------------------
+19 a aa%
+19 mn 61610909090909090909090909090909
+19 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+19 sp --------------------------------
+20 a cc%
+20 mn 63630909090909090909090909090909
+20 mx 6363EFBFBFEFBFBFEFBFBFEFBFBF2020
+20 sp --------------------------------
+21 a ch%
+21 mn 63680909090909090909090909090909
+21 mx 6368EFBFBFEFBFBFEFBFBFEFBFBF2020
+21 sp --------------------------------
+22 a aaa
+22 mn 616161
+22 mx 616161
+22 sp --------------------------------
+23 a ccc
+23 mn 636363
+23 mx 636363
+23 sp --------------------------------
+24 a cch
+24 mn 636368
+24 mx 636368
+24 sp --------------------------------
+25 a aaa_
+25 mn 61610909090909090909090909090909
+25 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+25 sp --------------------------------
+26 a ccc_
+26 mn 63636309090909090909090909090909
+26 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20
+26 sp --------------------------------
+27 a cch_
+27 mn 63636809090909090909090909090909
+27 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+27 sp --------------------------------
+28 a aaa%
+28 mn 61610909090909090909090909090909
+28 mx 6161EFBFBFEFBFBFEFBFBFEFBFBF2020
+28 sp --------------------------------
+29 a ccc%
+29 mn 63636309090909090909090909090909
+29 mx 636363EFBFBFEFBFBFEFBFBFEFBFBF20
+29 sp --------------------------------
+30 a cch%
+30 mn 63636809090909090909090909090909
+30 mx 636368EFBFBFEFBFBFEFBFBFEFBFBF20
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 61616161090909090909090909090909
+31 mx 61616161EFBFBFEFBFBFEFBFBFEFBFBF
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0000
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00000000000000000000000000000000
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00610000
+9 mx 0061FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00630000
+10 mx 0063FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00610000000000000000000000000000
+11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00630000000000000000000000000000
+12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610000
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 006300630000
+17 mx 00630063FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680000
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000000000000000000000000
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630063000000000000000000000000
+20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000000000000000000000000
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 0061006100610000
+25 mx 006100610061FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 0063006300630000
+26 mx 006300630063FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680000
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061006100000000000000000000
+28 mx 006100610061FFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063006300000000000000000000
+29 mx 006300630063FFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800000000000000000000
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00610061006100610061006100610061
+31 mx 00610061006100610061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0009
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00090009000900090009000900090009
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00610009
+9 mx 0061FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00630009
+10 mx 0063FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00610009000900090009000900090009
+11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00630009000900090009000900090009
+12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610009
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 006300630009
+17 mx 00630063FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680009
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000900090009000900090009
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630063000900090009000900090009
+20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000900090009000900090009
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 0061006100610009
+25 mx 006100610061FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 0063006300630009
+26 mx 006300630063FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680009
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061006100090009000900090009
+28 mx 006100610061FFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063006300090009000900090009
+29 mx 006300630063FFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800090009000900090009
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00610061006100610061006100610061
+31 mx 00610061006100610061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_czech_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0009
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00090009000900090009000900090009
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00610009
+9 mx 0061FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00090009000900090009000900090009
+10 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00610009000900090009000900090009
+11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00090009000900090009000900090009
+12 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610009
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 00630009000900090009000900090009
+17 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680009
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000900090009000900090009
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630009000900090009000900090009
+20 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000900090009000900090009
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 0061006100610009
+25 mx 006100610061FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 00630063000900090009000900090009
+26 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680009
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061006100090009000900090009
+28 mx 006100610061FFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063000900090009000900090009
+29 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800090009000900090009
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00610061006100610061006100610061
+31 mx 00610061006100610061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_danish_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0009
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00090009000900090009000900090009
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00090009000900090009000900090009
+9 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00630009
+10 mx 0063FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00090009000900090009000900090009
+11 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00630009000900090009000900090009
+12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610009
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 006300630009
+17 mx 00630063FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680009
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000900090009000900090009
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630063000900090009000900090009
+20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000900090009000900090009
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 00610061000900090009000900090009
+25 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 0063006300630009
+26 mx 006300630063FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680009
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061000900090009000900090009
+28 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063006300090009000900090009
+29 mx 006300630063FFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800090009000900090009
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00610061006100610061006100610061
+31 mx 00610061006100610061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0000
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00000000000000000000000000000000
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00610000
+9 mx 0061FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00630000
+10 mx 0063FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00610000000000000000000000000000
+11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00630000000000000000000000000000
+12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610000
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 006300630000
+17 mx 00630063FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680000
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000000000000000000000000
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630063000000000000000000000000
+20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000000000000000000000000
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 0061006100610000
+25 mx 006100610061FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 0063006300630000
+26 mx 006300630063FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680000
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061006100000000000000000000
+28 mx 006100610061FFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063006300000000000000000000
+29 mx 006300630063FFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800000000000000000000
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 0061006100610061
+31 mx 0061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_unicode_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0009
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00090009000900090009000900090009
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00610009
+9 mx 0061FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00630009
+10 mx 0063FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00610009000900090009000900090009
+11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00630009000900090009000900090009
+12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610009
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 006300630009
+17 mx 00630063FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680009
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000900090009000900090009
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630063000900090009000900090009
+20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000900090009000900090009
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 0061006100610009
+25 mx 006100610061FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 0063006300630009
+26 mx 006300630063FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680009
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061006100090009000900090009
+28 mx 006100610061FFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063006300090009000900090009
+29 mx 006300630063FFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800090009000900090009
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 0061006100610061
+31 mx 0061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_czech_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0009
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00090009000900090009000900090009
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00610009
+9 mx 0061FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00090009000900090009000900090009
+10 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00610009000900090009000900090009
+11 mx 0061FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00090009000900090009000900090009
+12 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610009
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 00630009000900090009000900090009
+17 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680009
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000900090009000900090009
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630009000900090009000900090009
+20 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000900090009000900090009
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 0061006100610009
+25 mx 006100610061FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 00630063000900090009000900090009
+26 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680009
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061006100090009000900090009
+28 mx 006100610061FFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063000900090009000900090009
+29 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800090009000900090009
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 0061006100610061
+31 mx 0061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_danish_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 0009
+2 mx FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00090009000900090009000900090009
+3 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+3 sp --------------------------------
+4 a \_
+4 mn 005F
+4 mx 005F
+4 sp --------------------------------
+5 a \%
+5 mn 0025
+5 mx 0025
+5 sp --------------------------------
+6 a \
+6 mn 005C
+6 mx 005C
+6 sp --------------------------------
+7 a a
+7 mn 0061
+7 mx 0061
+7 sp --------------------------------
+8 a c
+8 mn 0063
+8 mx 0063
+8 sp --------------------------------
+9 a a_
+9 mn 00090009000900090009000900090009
+9 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00630009
+10 mx 0063FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00090009000900090009000900090009
+11 mx FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00630009000900090009000900090009
+12 mx 0063FFFFFFFFFFFFFFFFFFFFFFFFFFFF
+12 sp --------------------------------
+13 a aa
+13 mn 00610061
+13 mx 00610061
+13 sp --------------------------------
+14 a cc
+14 mn 00630063
+14 mx 00630063
+14 sp --------------------------------
+15 a ch
+15 mn 00630068
+15 mx 00630068
+15 sp --------------------------------
+16 a aa_
+16 mn 006100610009
+16 mx 00610061FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 006300630009
+17 mx 00630063FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 006300680009
+18 mx 00630068FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00610061000900090009000900090009
+19 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00630063000900090009000900090009
+20 mx 00630063FFFFFFFFFFFFFFFFFFFFFFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00630068000900090009000900090009
+21 mx 00630068FFFFFFFFFFFFFFFFFFFFFFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 006100610061
+22 mx 006100610061
+22 sp --------------------------------
+23 a ccc
+23 mn 006300630063
+23 mx 006300630063
+23 sp --------------------------------
+24 a cch
+24 mn 006300630068
+24 mx 006300630068
+24 sp --------------------------------
+25 a aaa_
+25 mn 00610061000900090009000900090009
+25 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 0063006300630009
+26 mx 006300630063FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 0063006300680009
+27 mx 006300630068FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00610061000900090009000900090009
+28 mx 00610061FFFFFFFFFFFFFFFFFFFFFFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00630063006300090009000900090009
+29 mx 006300630063FFFFFFFFFFFFFFFFFFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00630063006800090009000900090009
+30 mx 006300630068FFFFFFFFFFFFFFFFFFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 0061006100610061
+31 mx 0061006100610061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00000000
+2 mx 0000FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00000000000000000000000000000000
+3 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+3 sp --------------------------------
+4 a \_
+4 mn 0000005F
+4 mx 0000005F
+4 sp --------------------------------
+5 a \%
+5 mn 00000025
+5 mx 00000025
+5 sp --------------------------------
+6 a \
+6 mn 0000005C
+6 mx 0000005C
+6 sp --------------------------------
+7 a a
+7 mn 00000061
+7 mx 00000061
+7 sp --------------------------------
+8 a c
+8 mn 00000063
+8 mx 00000063
+8 sp --------------------------------
+9 a a_
+9 mn 0000006100000000
+9 mx 000000610000FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 0000006300000000
+10 mx 000000630000FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00000061000000000000000000000000
+11 mx 000000610000FFFF0000FFFF0000FFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00000063000000000000000000000000
+12 mx 000000630000FFFF0000FFFF0000FFFF
+12 sp --------------------------------
+13 a aa
+13 mn 0000006100000061
+13 mx 0000006100000061
+13 sp --------------------------------
+14 a cc
+14 mn 0000006300000063
+14 mx 0000006300000063
+14 sp --------------------------------
+15 a ch
+15 mn 0000006300000068
+15 mx 0000006300000068
+15 sp --------------------------------
+16 a aa_
+16 mn 000000610000006100000000
+16 mx 00000061000000610000FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 000000630000006300000000
+17 mx 00000063000000630000FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 000000630000006800000000
+18 mx 00000063000000680000FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00000061000000610000000000000000
+19 mx 00000061000000610000FFFF0000FFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00000063000000630000000000000000
+20 mx 00000063000000630000FFFF0000FFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00000063000000680000000000000000
+21 mx 00000063000000680000FFFF0000FFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 000000610000006100000061
+22 mx 000000610000006100000061
+22 sp --------------------------------
+23 a ccc
+23 mn 000000630000006300000063
+23 mx 000000630000006300000063
+23 sp --------------------------------
+24 a cch
+24 mn 000000630000006300000068
+24 mx 000000630000006300000068
+24 sp --------------------------------
+25 a aaa_
+25 mn 00000061000000610000006100000000
+25 mx 0000006100000061000000610000FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 00000063000000630000006300000000
+26 mx 0000006300000063000000630000FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 00000063000000630000006800000000
+27 mx 0000006300000063000000680000FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00000061000000610000006100000000
+28 mx 0000006100000061000000610000FFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00000063000000630000006300000000
+29 mx 0000006300000063000000630000FFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00000063000000630000006800000000
+30 mx 0000006300000063000000680000FFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00000061000000610000006100000061
+31 mx 00000061000000610000006100000061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_unicode_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00000009
+2 mx 0000FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00000009000000090000000900000009
+3 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+3 sp --------------------------------
+4 a \_
+4 mn 0000005F
+4 mx 0000005F
+4 sp --------------------------------
+5 a \%
+5 mn 00000025
+5 mx 00000025
+5 sp --------------------------------
+6 a \
+6 mn 0000005C
+6 mx 0000005C
+6 sp --------------------------------
+7 a a
+7 mn 00000061
+7 mx 00000061
+7 sp --------------------------------
+8 a c
+8 mn 00000063
+8 mx 00000063
+8 sp --------------------------------
+9 a a_
+9 mn 0000006100000009
+9 mx 000000610000FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 0000006300000009
+10 mx 000000630000FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00000061000000090000000900000009
+11 mx 000000610000FFFF0000FFFF0000FFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00000063000000090000000900000009
+12 mx 000000630000FFFF0000FFFF0000FFFF
+12 sp --------------------------------
+13 a aa
+13 mn 0000006100000061
+13 mx 0000006100000061
+13 sp --------------------------------
+14 a cc
+14 mn 0000006300000063
+14 mx 0000006300000063
+14 sp --------------------------------
+15 a ch
+15 mn 0000006300000068
+15 mx 0000006300000068
+15 sp --------------------------------
+16 a aa_
+16 mn 000000610000006100000009
+16 mx 00000061000000610000FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 000000630000006300000009
+17 mx 00000063000000630000FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 000000630000006800000009
+18 mx 00000063000000680000FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00000061000000610000000900000009
+19 mx 00000061000000610000FFFF0000FFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00000063000000630000000900000009
+20 mx 00000063000000630000FFFF0000FFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00000063000000680000000900000009
+21 mx 00000063000000680000FFFF0000FFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 000000610000006100000061
+22 mx 000000610000006100000061
+22 sp --------------------------------
+23 a ccc
+23 mn 000000630000006300000063
+23 mx 000000630000006300000063
+23 sp --------------------------------
+24 a cch
+24 mn 000000630000006300000068
+24 mx 000000630000006300000068
+24 sp --------------------------------
+25 a aaa_
+25 mn 00000061000000610000006100000009
+25 mx 0000006100000061000000610000FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 00000063000000630000006300000009
+26 mx 0000006300000063000000630000FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 00000063000000630000006800000009
+27 mx 0000006300000063000000680000FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00000061000000610000006100000009
+28 mx 0000006100000061000000610000FFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00000063000000630000006300000009
+29 mx 0000006300000063000000630000FFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00000063000000630000006800000009
+30 mx 0000006300000063000000680000FFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00000061000000610000006100000061
+31 mx 00000061000000610000006100000061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_czech_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00000009
+2 mx 0000FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00000009000000090000000900000009
+3 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+3 sp --------------------------------
+4 a \_
+4 mn 0000005F
+4 mx 0000005F
+4 sp --------------------------------
+5 a \%
+5 mn 00000025
+5 mx 00000025
+5 sp --------------------------------
+6 a \
+6 mn 0000005C
+6 mx 0000005C
+6 sp --------------------------------
+7 a a
+7 mn 00000061
+7 mx 00000061
+7 sp --------------------------------
+8 a c
+8 mn 00000063
+8 mx 00000063
+8 sp --------------------------------
+9 a a_
+9 mn 0000006100000009
+9 mx 000000610000FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 00000009000000090000000900000009
+10 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00000061000000090000000900000009
+11 mx 000000610000FFFF0000FFFF0000FFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00000009000000090000000900000009
+12 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+12 sp --------------------------------
+13 a aa
+13 mn 0000006100000061
+13 mx 0000006100000061
+13 sp --------------------------------
+14 a cc
+14 mn 0000006300000063
+14 mx 0000006300000063
+14 sp --------------------------------
+15 a ch
+15 mn 0000006300000068
+15 mx 0000006300000068
+15 sp --------------------------------
+16 a aa_
+16 mn 000000610000006100000009
+16 mx 00000061000000610000FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 00000063000000090000000900000009
+17 mx 000000630000FFFF0000FFFF0000FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 000000630000006800000009
+18 mx 00000063000000680000FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00000061000000610000000900000009
+19 mx 00000061000000610000FFFF0000FFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00000063000000090000000900000009
+20 mx 000000630000FFFF0000FFFF0000FFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00000063000000680000000900000009
+21 mx 00000063000000680000FFFF0000FFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 000000610000006100000061
+22 mx 000000610000006100000061
+22 sp --------------------------------
+23 a ccc
+23 mn 000000630000006300000063
+23 mx 000000630000006300000063
+23 sp --------------------------------
+24 a cch
+24 mn 000000630000006300000068
+24 mx 000000630000006300000068
+24 sp --------------------------------
+25 a aaa_
+25 mn 00000061000000610000006100000009
+25 mx 0000006100000061000000610000FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 00000063000000630000000900000009
+26 mx 00000063000000630000FFFF0000FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 00000063000000630000006800000009
+27 mx 0000006300000063000000680000FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00000061000000610000006100000009
+28 mx 0000006100000061000000610000FFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00000063000000630000000900000009
+29 mx 00000063000000630000FFFF0000FFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00000063000000630000006800000009
+30 mx 0000006300000063000000680000FFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00000061000000610000006100000061
+31 mx 00000061000000610000006100000061
+31 sp --------------------------------
+ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_danish_ci;
+SELECT * FROM v1;
+id name val
+1 a
+1 mn
+1 mx
+1 sp --------------------------------
+2 a _
+2 mn 00000009
+2 mx 0000FFFF
+2 sp --------------------------------
+3 a %
+3 mn 00000009000000090000000900000009
+3 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+3 sp --------------------------------
+4 a \_
+4 mn 0000005F
+4 mx 0000005F
+4 sp --------------------------------
+5 a \%
+5 mn 00000025
+5 mx 00000025
+5 sp --------------------------------
+6 a \
+6 mn 0000005C
+6 mx 0000005C
+6 sp --------------------------------
+7 a a
+7 mn 00000061
+7 mx 00000061
+7 sp --------------------------------
+8 a c
+8 mn 00000063
+8 mx 00000063
+8 sp --------------------------------
+9 a a_
+9 mn 00000009000000090000000900000009
+9 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+9 sp --------------------------------
+10 a c_
+10 mn 0000006300000009
+10 mx 000000630000FFFF
+10 sp --------------------------------
+11 a a%
+11 mn 00000009000000090000000900000009
+11 mx 0000FFFF0000FFFF0000FFFF0000FFFF
+11 sp --------------------------------
+12 a c%
+12 mn 00000063000000090000000900000009
+12 mx 000000630000FFFF0000FFFF0000FFFF
+12 sp --------------------------------
+13 a aa
+13 mn 0000006100000061
+13 mx 0000006100000061
+13 sp --------------------------------
+14 a cc
+14 mn 0000006300000063
+14 mx 0000006300000063
+14 sp --------------------------------
+15 a ch
+15 mn 0000006300000068
+15 mx 0000006300000068
+15 sp --------------------------------
+16 a aa_
+16 mn 000000610000006100000009
+16 mx 00000061000000610000FFFF
+16 sp --------------------------------
+17 a cc_
+17 mn 000000630000006300000009
+17 mx 00000063000000630000FFFF
+17 sp --------------------------------
+18 a ch_
+18 mn 000000630000006800000009
+18 mx 00000063000000680000FFFF
+18 sp --------------------------------
+19 a aa%
+19 mn 00000061000000610000000900000009
+19 mx 00000061000000610000FFFF0000FFFF
+19 sp --------------------------------
+20 a cc%
+20 mn 00000063000000630000000900000009
+20 mx 00000063000000630000FFFF0000FFFF
+20 sp --------------------------------
+21 a ch%
+21 mn 00000063000000680000000900000009
+21 mx 00000063000000680000FFFF0000FFFF
+21 sp --------------------------------
+22 a aaa
+22 mn 000000610000006100000061
+22 mx 000000610000006100000061
+22 sp --------------------------------
+23 a ccc
+23 mn 000000630000006300000063
+23 mx 000000630000006300000063
+23 sp --------------------------------
+24 a cch
+24 mn 000000630000006300000068
+24 mx 000000630000006300000068
+24 sp --------------------------------
+25 a aaa_
+25 mn 00000061000000610000000900000009
+25 mx 00000061000000610000FFFF0000FFFF
+25 sp --------------------------------
+26 a ccc_
+26 mn 00000063000000630000006300000009
+26 mx 0000006300000063000000630000FFFF
+26 sp --------------------------------
+27 a cch_
+27 mn 00000063000000630000006800000009
+27 mx 0000006300000063000000680000FFFF
+27 sp --------------------------------
+28 a aaa%
+28 mn 00000061000000610000000900000009
+28 mx 00000061000000610000FFFF0000FFFF
+28 sp --------------------------------
+29 a ccc%
+29 mn 00000063000000630000006300000009
+29 mx 0000006300000063000000630000FFFF
+29 sp --------------------------------
+30 a cch%
+30 mn 00000063000000630000006800000009
+30 mx 0000006300000063000000680000FFFF
+30 sp --------------------------------
+31 a aaaaaaaaaaaaaaaaaaaa
+31 mn 00000061000000610000006100000061
+31 mx 00000061000000610000006100000061
+31 sp --------------------------------
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index 4730b4df668..4ea5efab159 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -1684,6 +1684,24 @@ ARMENIAN CAPIT ECH 2
ARMENIAN CAPIT ZA 2
DROP TABLE t1;
#
+# Start of 5.1 tests
+#
+#
+# Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
+#
+SET NAMES latin1;
+DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
+AS BINARY(0)) USING utf8);
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
+Warning 1292 Truncated incorrect BINARY(0) value: '1.'
+#
+# End of 5.1 tests
+#
+#
+# Start of 5.5 tests
+#
+#
# WL#1213 Implement 4-byte UTF8, UTF16 and UTF32
# Testing that only utf8mb4 is superset for utf8
# No other Unicode character set pairs have superset/subset relations
@@ -1739,3 +1757,22 @@ ERROR HY000: Illegal mix of collations (utf32_general_ci,IMPLICIT) and (utf8mb4_
SELECT CHARSET(CONCAT(utf32, utf16)) FROM t1;
ERROR HY000: Illegal mix of collations (utf32_general_ci,IMPLICIT) and (utf16_general_ci,IMPLICIT) for operation 'concat'
DROP TABLE t1;
+#
+# Bug#58321 No warning when characters outside BMP0 is converted to UCS2
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32);
+CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET ucs2);
+INSERT INTO t1 VALUES (0x10082), (0x12345);
+INSERT INTO t2 SELECT * FROM t1;
+Warnings:
+Warning 1366 Incorrect string value: '\x00\x01\x00\x82' for column 'a' at row 1
+Warning 1366 Incorrect string value: '\x00\x01\x23\x45' for column 'a' at row 2
+SELECT HEX(a) FROM t2;
+HEX(a)
+003F
+003F
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index 78827b5b907..abeb19c0c8f 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -218,6 +218,12 @@ hex(a) hex(lower(a)) hex(upper(a))
8352835E 8352835E 8352835E
8372835E 8372835E 8372835E
DROP TABLE t1;
+#
+# Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
+#
+SELECT QUOTE('ƒ\');
+QUOTE('ƒ\')
+'ƒ\'
# End of 5.1 tests
#
# Start of 5.5 tests
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index d51cd2b1d06..7afcc0ef049 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -3007,3 +3007,101 @@ a hex(b) c
DROP TABLE t1;
set names utf8;
End for 5.0 tests
+#
+# Start of 5.5 tests
+#
+SET collation_connection=utf8_czech_ci;
+SELECT @@collation_connection;
+@@collation_connection
+utf8_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
+SELECT * FROM t1 WHERE s1 LIKE 'ch';
+s1
+ch
+DROP TABLE t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf8_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+# Part#2 - ignorable characters
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+61000000000009
+61
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+61000000000009
+61
+DROP TABLE t1;
+SET collation_connection=ucs2_czech_ci;
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
+SELECT * FROM t1 WHERE s1 LIKE 'ch';
+s1
+ch
+DROP TABLE t1;
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+# Part#2 - ignorable characters
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+0061000000000000000000000009
+0061
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+0061000000000000000000000009
+0061
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 8d35cf445e8..2dad45e5639 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -990,8 +990,8 @@ old_password(name)
14e500b131773991
select quote(name) from bug20536;
quote(name)
-????????
-????????????????
+'test1'
+'\'test\\_2\''
drop table bug20536;
set names ucs2;
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
@@ -1238,6 +1238,17 @@ CREATE VIEW v1 AS SELECT 1 from t1
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
+#
+SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850));
+HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850))
+00
+SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED);
+CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
End of 5.0 tests
#
# Start of 5.1 tests
@@ -2717,7 +2728,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+ `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -3338,7 +3349,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+ `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a year);
@@ -3647,7 +3658,7 @@ insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(2) YES NULL
+a varchar(4) YES NULL
select hex(a) from v1;
hex(a)
00300031
@@ -3903,6 +3914,9 @@ GROUP_CONCAT(IFNULL(a,''))
SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
GROUP_CONCAT(IF(a,a,''))
1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(a,'') 253 9 7 Y 0 31 8
@@ -4037,6 +4051,91 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+DROP TABLE t1;
+#
+# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection @@character_set_results
+ucs2_general_ci latin1
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `field_str1` varchar(29) CHARACTER SET ucs2 DEFAULT NULL,
+ `field1_str2` varchar(29) CHARACTER SET ucs2 DEFAULT NULL,
+ `field_date` date DEFAULT NULL,
+ `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def field_str1 254 29 10 Y 0 31 8
+def field1_str2 254 29 19 Y 0 31 8
+def field_date 10 29 10 Y 128 31 63
+def field_datetime 12 29 19 Y 128 31 63
+field_str1 field1_str2 field_date field_datetime
+2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1 field1_str2 field_date field_datetime
+0032003000300037002D00300038002D00300032002000320033003A00350039003A00300030 0032003000300037002D00300038002D00300033002000310037003A00330032003A00300030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
+#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(now() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 946aa1c780e..b801a7f45a4 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -2374,6 +2374,16 @@ hex(convert(_latin1 0xA4A2 using ujis)) hex(c2)
DROP PROCEDURE sp1;
DROP TABLE t1;
DROP TABLE t2;
+#
+# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
+#
+SET NAMES utf8;
+SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis);
+CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis)
+
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
set names default;
set character_set_database=default;
set character_set_server=default;
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index 0d5280950df..07308c8e0e0 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -31,13 +31,13 @@ binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
1 1 1
select hex(_utf16 0x44);
hex(_utf16 0x44)
-00000044
+0044
select hex(_utf16 0x3344);
hex(_utf16 0x3344)
3344
select hex(_utf16 0x113344);
hex(_utf16 0x113344)
-000000113344
+00113344
CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf16;
INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (X'2004',X'2004');
SELECT hex(word) FROM t1 ORDER BY word;
@@ -435,10 +435,10 @@ aardvarz
DROP TABLE t1;
SELECT hex(cast(0xAA as char character set utf16));
hex(cast(0xAA as char character set utf16))
-000000AA
+00AA
SELECT hex(convert(0xAA using utf16));
hex(convert(0xAA using utf16))
-000000AA
+00AA
CREATE TABLE t1 (a char(10) character set utf16);
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
SELECT HEX(a) FROM t1;
@@ -626,16 +626,16 @@ INSERT INTO t1 VALUES (_utf8mb4 0xCE85),(_utf8mb4 0xF4808080);
SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
HEX(a) HEX(CONVERT(a USING utf8mb4))
0385 CE85
+FF9D EFBE9D
D800DF84 F0908E84
DBC0DC00 F4808080
-FF9D EFBE9D
ALTER TABLE t1 ADD KEY(a);
SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
HEX(a) HEX(CONVERT(a USING utf8mb4))
0385 CE85
+FF9D EFBE9D
D800DF84 F0908E84
DBC0DC00 F4808080
-FF9D EFBE9D
DROP TABLE IF EXISTS t1;
select @@collation_connection;
@@collation_connection
@@ -1103,5 +1103,20 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
#
+# Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
+#
+SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END;
+CASE _latin1'a' WHEN _utf16'a' THEN 'A' END
+A
+SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END;
+CASE _utf16'a' WHEN _latin1'a' THEN 'A' END
+A
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16);
+INSERT INTO t1 VALUES ('a');
+SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
+CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END
+b
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result
index d83ef2af09e..18adaf2f79c 100644
--- a/mysql-test/r/ctype_utf16_uca.result
+++ b/mysql-test/r/ctype_utf16_uca.result
@@ -2368,6 +2368,52 @@ NULL
NULL
NULL
drop table t1;
+SET collation_connection=utf16_czech_ci;
+SELECT @@collation_connection;
+@@collation_connection
+utf16_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
+SELECT * FROM t1 WHERE s1 LIKE 'ch';
+s1
+ch
+DROP TABLE t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf16_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+# Part#2 - ignorable characters
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+0061000000000000000000000009
+0061
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+0061000000000000000000000009
+0061
+DROP TABLE t1;
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index cca4efd1571..7d9db0cc41e 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1153,5 +1153,20 @@ d
f
DROP TABLE t1;
#
+# Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
+#
+SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END;
+CASE _latin1'a' WHEN _utf32'a' THEN 'A' END
+A
+SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END;
+CASE _utf32'a' WHEN _latin1'a' THEN 'A' END
+A
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32);
+INSERT INTO t1 VALUES ('a');
+SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
+CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END
+b
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result
index 5006009fc9c..fd5a4199217 100644
--- a/mysql-test/r/ctype_utf32_uca.result
+++ b/mysql-test/r/ctype_utf32_uca.result
@@ -2368,6 +2368,52 @@ NULL
NULL
NULL
drop table t1;
+SET collation_connection=utf32_czech_ci;
+SELECT @@collation_connection;
+@@collation_connection
+utf32_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT * FROM t1 WHERE s1 LIKE 'c%';
+s1
+c
+ce
+cé
+ch
+ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
+SELECT * FROM t1 WHERE s1 LIKE 'ch';
+s1
+ch
+DROP TABLE t1;
+SELECT @@collation_connection;
+@@collation_connection
+utf32_czech_ci
+#
+# Bug#57737 Character sets: search fails with like, contraction, index
+# Part#2 - ignorable characters
+#
+CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
+INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+00000061000000000000000000000000000000000000000000000009
+00000061
+ALTER TABLE t1 ADD KEY s1 (s1);
+SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
+HEX(s1)
+00000061000000000000000000000000000000000000000000000009
+00000061
+DROP TABLE t1;
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 4c3b661ce90..930917b3268 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1901,6 +1901,37 @@ CONVERT(a, CHAR) CONVERT(b, CHAR)
70000 1092
DROP TABLE t1;
End of 5.0 tests
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'ÑÑÑŽÑ'));
+LENGTH(RPAD(0.0115E88, 61297, _utf8'ÑÑÑŽÑ'))
+122587
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуÑ'));
+LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуÑ'))
+122587
+SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F));
+HEX(RPAD(0x20, 2, _utf8 0xD18F))
+20D1
+SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F));
+HEX(RPAD(0x20, 4, _utf8 0xD18F))
+20D18FD1
+SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
+HEX(LPAD(0x20, 2, _utf8 0xD18F))
+D120
+SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
+HEX(LPAD(0x20, 4, _utf8 0xD18F))
+D18FD120
+SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
+HEX(RPAD(_utf8 0xD18F, 3, 0x20))
+D18F20
+SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
+HEX(LPAD(_utf8 0xD18F, 3, 0x20))
+20D18F
+SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
+HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20))
+D120
+SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
+HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
+D120D18E
+End of 5.1 tests
Start of 5.4 tests
SET NAMES utf8mb3;
SHOW VARIABLES LIKE 'character_set_results%';
@@ -2043,6 +2074,20 @@ predicted_order hex(utf8_encoding)
100 E0B78AE2808DE0B6BA
101 E0B78AE2808DE0B6BB
DROP TABLE t1;
+SET NAMES utf8 COLLATE utf8_sinhala_ci;
+CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci);
+INSERT INTO t1 VALUES ('a'),('ae'),('af');
+SELECT s1,hex(s1) FROM t1 ORDER BY s1;
+s1 hex(s1)
+a 61
+ae 6165
+af 6166
+SELECT * FROM t1 ORDER BY s1;
+s1
+a
+ae
+af
+DROP TABLE t1;
End of 5.4 tests
#
# Start of 5.5 tests
@@ -3515,7 +3560,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(extract(year from 20090702)));
@@ -4136,7 +4181,7 @@ create table t2 as select concat(a) from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `concat(a)` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+ `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (a year);
@@ -4445,7 +4490,7 @@ insert into t1 values (1);
create view v1(a) as select concat(a) from t1;
show columns from v1;
Field Type Null Key Default Extra
-a varchar(2) YES NULL
+a varchar(4) YES NULL
select hex(a) from v1;
hex(a)
3031
@@ -4838,6 +4883,91 @@ DROP TABLE t1;
# End of Bug#54916
#
#
+# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
+#
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+CREATE TABLE t1 (
+id INT(11) DEFAULT NULL,
+date_column DATE DEFAULT NULL,
+KEY(date_column));
+INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 4 NULL 1 Using where
+ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
+EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range date_column date_column 9 NULL 1 Using where
+DROP TABLE t1;
+#
+# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
+#
+SELECT @@collation_connection, @@character_set_results;
+@@collation_connection @@character_set_results
+utf8_general_ci utf8
+CREATE TABLE t1 AS
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `field_str1` varchar(29) CHARACTER SET utf8 DEFAULT NULL,
+ `field1_str2` varchar(29) CHARACTER SET utf8 DEFAULT NULL,
+ `field_date` date DEFAULT NULL,
+ `field_datetime` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SELECT
+DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1,
+DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2,
+DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date,
+DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def field_str1 254 87 10 Y 0 31 33
+def field1_str2 254 87 19 Y 0 31 33
+def field_date 10 29 10 Y 128 31 63
+def field_datetime 12 29 19 Y 128 31 63
+field_str1 field1_str2 field_date field_datetime
+2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00
+SELECT
+HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1,
+HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2,
+HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date,
+HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime;
+field_str1 field1_str2 field_date field_datetime
+323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030
+#
+# Bug#11926811 / Bug#60625 Illegal mix of collations
+#
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_LastPaymentDate DATETIME DEFAULT NULL;
+SELECT v_LastPaymentDate < NOW();
+EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW();
+SHOW WARNINGS;
+EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW());
+END//
+CALL p1;
+v_LastPaymentDate < NOW()
+NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Level Code Message
+Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()`
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),now()) AS `CONCAT(v_LastPaymentDate, NOW())`
+DROP PROCEDURE p1;
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
@@ -4858,5 +4988,31 @@ maketime(`a`,`a`,`a`)
DROP TABLE t1;
SET sql_mode=default;
#
+# Bug#57687 crash when reporting duplicate group_key error and utf8
+# Make sure to modify this when Bug#58081 is fixed.
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
+SELECT COUNT(*) FROM t1, t1 t2
+GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
+ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key'
+DROP TABLE t1;
+#
+# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
+#
+SET NAMES latin1;
+EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ' AS u;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 'abcdÃÂÃÄÅ' AS `abcdÃÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `u`
+SET NAMES utf8;
+EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 'abcdÃÂÃÄÅ' AS `abcdÃÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÃÄÅ`
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8mb4_ndb.result b/mysql-test/r/ctype_utf8mb4_ndb.result
deleted file mode 100644
index 2a11c13ce57..00000000000
--- a/mysql-test/r/ctype_utf8mb4_ndb.result
+++ /dev/null
@@ -1,1876 +0,0 @@
-drop table if exists t1,t2;
-#
-# Start of 5.5 tests
-#
-set names utf8mb4;
-select left(_utf8mb4 0xD0B0D0B1D0B2,1);
-left(_utf8mb4 0xD0B0D0B1D0B2,1)
-а
-select right(_utf8mb4 0xD0B0D0B2D0B2,1);
-right(_utf8mb4 0xD0B0D0B2D0B2,1)
-в
-select locate('he','hello');
-locate('he','hello')
-1
-select locate('he','hello',2);
-locate('he','hello',2)
-0
-select locate('lo','hello',2);
-locate('lo','hello',2)
-4
-select locate('HE','hello');
-locate('HE','hello')
-1
-select locate('HE','hello',2);
-locate('HE','hello',2)
-0
-select locate('LO','hello',2);
-locate('LO','hello',2)
-4
-select locate('HE','hello' collate utf8mb4_bin);
-locate('HE','hello' collate utf8mb4_bin)
-0
-select locate('HE','hello' collate utf8mb4_bin,2);
-locate('HE','hello' collate utf8mb4_bin,2)
-0
-select locate('LO','hello' collate utf8mb4_bin,2);
-locate('LO','hello' collate utf8mb4_bin,2)
-0
-select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2);
-locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2)
-2
-select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2);
-locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2)
-2
-select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2);
-locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2)
-2
-select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin);
-locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin)
-0
-select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin);
-locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin)
-0
-select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1);
-length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) char_length(_utf8mb4 0xD0B1)
-2 16 1
-select 'a' like 'a';
-'a' like 'a'
-1
-select 'A' like 'a';
-'A' like 'a'
-1
-select 'A' like 'a' collate utf8mb4_bin;
-'A' like 'a' collate utf8mb4_bin
-0
-select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%');
-_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%')
-1
-select convert(_latin1'Günter André' using utf8mb4) like CONVERT(_latin1'GÜNTER%' USING utf8mb4);
-convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4)
-1
-select CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4) LIKE CONVERT(_koi8r'÷áóñ' USING utf8mb4);
-CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
-1
-select CONVERT(_koi8r'÷áóñ' USING utf8mb4) LIKE CONVERT(_koi8r'×ÁÓÑ' USING utf8mb4);
-CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4)
-1
-SELECT 'a' = 'a ';
-'a' = 'a '
-1
-SELECT 'a\0' < 'a';
-'a\0' < 'a'
-1
-SELECT 'a\0' < 'a ';
-'a\0' < 'a '
-1
-SELECT 'a\t' < 'a';
-'a\t' < 'a'
-1
-SELECT 'a\t' < 'a ';
-'a\t' < 'a '
-1
-SELECT 'a' = 'a ' collate utf8mb4_bin;
-'a' = 'a ' collate utf8mb4_bin
-1
-SELECT 'a\0' < 'a' collate utf8mb4_bin;
-'a\0' < 'a' collate utf8mb4_bin
-1
-SELECT 'a\0' < 'a ' collate utf8mb4_bin;
-'a\0' < 'a ' collate utf8mb4_bin
-1
-SELECT 'a\t' < 'a' collate utf8mb4_bin;
-'a\t' < 'a' collate utf8mb4_bin
-1
-SELECT 'a\t' < 'a ' collate utf8mb4_bin;
-'a\t' < 'a ' collate utf8mb4_bin
-1
-CREATE TABLE t1 (a char(10) character set utf8mb4 not null) ENGINE ndb;
-INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
-SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
-hex(a) STRCMP(a,'a') STRCMP(a,'a ')
-61 0 0
-61 0 0
-6100 -1 -1
-6109 -1 -1
-DROP TABLE t1;
-select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
-insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
-this is a test
-select insert("aa",100,1,"b"),insert("aa",1,3,"b");
-insert("aa",100,1,"b") insert("aa",1,3,"b")
-aa b
-select char_length(left(@a:='теÑÑ‚',5)), length(@a), @a;
-char_length(left(@a:='теÑÑ‚',5)) length(@a) @a
-4 8 теÑÑ‚
-create table t1 ENGINE ndb select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
-select * from t1;
-date_format("2004-01-19 10:10:10", "%Y-%m-%d")
-2004-01-19
-drop table t1;
-set names utf8mb4;
-set LC_TIME_NAMES='fr_FR';
-create table t1 (s1 char(20) character set latin1) engine ndb;
-insert into t1 values (date_format('2004-02-02','%M'));
-select hex(s1) from t1;
-hex(s1)
-66E97672696572
-drop table t1;
-create table t1 (s1 char(20) character set koi8r) engine ndb;
-set LC_TIME_NAMES='ru_RU';
-insert into t1 values (date_format('2004-02-02','%M'));
-insert into t1 values (date_format('2004-02-02','%b'));
-insert into t1 values (date_format('2004-02-02','%W'));
-insert into t1 values (date_format('2004-02-02','%a'));
-select hex(s1), s1 from t1;
-hex(s1) s1
-E6C5D7 Фев
-E6C5D7D2C1CCD1 ФевралÑ
-F0CEC4 Пнд
-F0CFCEC5C4C5CCD8CEC9CB Понедельник
-drop table t1;
-set LC_TIME_NAMES='en_US';
-set names koi8r;
-create table t1 (s1 char(1) character set utf8mb4) engine ndb;
-insert into t1 values (_koi8r'ÁÂ');
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
-s1 hex(s1) char_length(s1) octet_length(s1)
-Á D0B0 1 2
-drop table t1;
-create table t1 (s1 tinytext character set utf8mb4) engine ndb;
-Warnings:
-Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
-insert into t1 select repeat('a',300);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',300);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',300);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',300);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',300);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-select hex(s1) from t1;
-hex(s1)
-616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
-61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
-D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
-D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
-D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
-select length(s1),char_length(s1) from t1;
-length(s1) char_length(s1)
-254 127
-254 127
-255 170
-255 170
-255 255
-drop table t1;
-create table t1 (s1 text character set utf8mb4) engine ndb;
-Warnings:
-Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
-insert into t1 select repeat('a',66000);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ñ',66000);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('aÑ',66000);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('Ña',66000);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-insert into t1 select repeat('ÑÑ',66000);
-Warnings:
-Warning 1265 Data truncated for column 's1' at row 1
-select length(s1),char_length(s1) from t1;
-length(s1) char_length(s1)
-65534 32767
-65534 32767
-65535 43690
-65535 43690
-65535 65535
-drop table t1;
-create table t1 (s1 char(10) character set utf8mb4) engine ndb;
-insert into t1 values (0x41FF);
-Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
-select hex(s1) from t1;
-hex(s1)
-41
-drop table t1;
-create table t1 (s1 varchar(10) character set utf8mb4) engine ndb;
-insert into t1 values (0x41FF);
-Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
-select hex(s1) from t1;
-hex(s1)
-41
-drop table t1;
-create table t1 (s1 text character set utf8mb4) engine ndb;
-Warnings:
-Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
-insert into t1 values (0x41FF);
-Warnings:
-Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1
-select hex(s1) from t1;
-hex(s1)
-41
-drop table t1;
-create table t1 (a text character set utf8mb4, primary key(a(371))) engine ndb;
-ERROR 42000: BLOB column 'a' can't be used in key specification with the used table type
-CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8mb4 ENGINE ndb;
-INSERT INTO t1 VALUES ( 'test' );
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a;
-a a
-test test
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = 'test' and b.a = 'test';
-a a
-test test
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a and a.a = 'test';
-a a
-test test
-DROP TABLE t1;
-create table t1 (a char(255) character set utf8mb4) engine ndb;
-insert into t1 values('b'),('b');
-select * from t1 where a = 'b';
-a
-b
-b
-select * from t1 where a = 'b' and a = 'b';
-a
-b
-b
-select * from t1 where a = 'b' and a != 'b';
-a
-drop table t1;
-set collation_connection=utf8mb4_general_ci;
-drop table if exists t1;
-create table t1 as
-select repeat(' ', 64) as s1, repeat(' ',64) as s2
-union
-select null, null;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL,
- `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-delete from t1;
-insert into t1 values('aaa','aaa');
-insert into t1 values('aaa|qqq','qqq');
-insert into t1 values('gheis','^[^a-dXYZ]+$');
-insert into t1 values('aab','^aa?b');
-insert into t1 values('Baaan','^Ba*n');
-insert into t1 values('aaa','qqq|aaa');
-insert into t1 values('qqq','qqq|aaa');
-insert into t1 values('bbb','qqq|aaa');
-insert into t1 values('bbb','qqq');
-insert into t1 values('aaa','aba');
-insert into t1 values(null,'abc');
-insert into t1 values('def',null);
-insert into t1 values(null,null);
-insert into t1 values('ghi','ghi[');
-select HIGH_PRIORITY s1 regexp s2 from t1;
-s1 regexp s2
-1
-1
-1
-1
-1
-1
-1
-0
-0
-0
-NULL
-NULL
-NULL
-NULL
-drop table t1;
-set names utf8mb4;
-set names utf8mb4;
-select 'ваÑÑ' rlike '[[:<:]]ваÑÑ[[:>:]]';
-'ваÑÑ' rlike '[[:<:]]ваÑÑ[[:>:]]'
-1
-select 'ваÑÑ ' rlike '[[:<:]]ваÑÑ[[:>:]]';
-'ваÑÑ ' rlike '[[:<:]]ваÑÑ[[:>:]]'
-1
-select ' ваÑÑ' rlike '[[:<:]]ваÑÑ[[:>:]]';
-' ваÑÑ' rlike '[[:<:]]ваÑÑ[[:>:]]'
-1
-select ' ваÑÑ ' rlike '[[:<:]]ваÑÑ[[:>:]]';
-' ваÑÑ ' rlike '[[:<:]]ваÑÑ[[:>:]]'
-1
-select 'ваÑÑz' rlike '[[:<:]]ваÑÑ[[:>:]]';
-'ваÑÑz' rlike '[[:<:]]ваÑÑ[[:>:]]'
-0
-select 'zваÑÑ' rlike '[[:<:]]ваÑÑ[[:>:]]';
-'zваÑÑ' rlike '[[:<:]]ваÑÑ[[:>:]]'
-0
-select 'zваÑÑz' rlike '[[:<:]]ваÑÑ[[:>:]]';
-'zваÑÑz' rlike '[[:<:]]ваÑÑ[[:>:]]'
-0
-CREATE TABLE t1 (a enum ('Y', 'N') DEFAULT 'N' COLLATE utf8mb4_unicode_ci) ENGINE ndb;
-ALTER TABLE t1 ADD COLUMN b CHAR(20);
-DROP TABLE t1;
-set names utf8mb4;
-create table t1 (a enum('aaaa','проба') character set utf8mb4) engine ndb;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
-insert into t1 values ('проба');
-select * from t1;
-a
-проба
-create table t2 engine ndb select ifnull(a,a) from t1;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
-select * from t2;
-ifnull(a,a)
-проба
-drop table t1;
-drop table t2;
-create table t1 (
-str varchar(255) character set utf8mb4 not null,
-key str (str(2))
-) engine=ndb;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-str
-str
-drop table t1;
-create table t1 (
-str varchar(255) character set utf8mb4 not null,
-key str (str(2))
-) engine=ndb;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-str
-str
-drop table t1;
-create table t1 (
-str varchar(255) character set utf8mb4 not null,
-key str using btree (str(2))
-) engine=ndb;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-str
-str
-drop table t1;
-CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8mb4 ENGINE ndb;
-INSERT INTO t1 VALUES ('test');
-SELECT a FROM t1 WHERE a LIKE '%te';
-a
-DROP TABLE t1;
-SET NAMES utf8mb4;
-CREATE TABLE t1 (
-subject varchar(255) character set utf8mb4 collate utf8mb4_unicode_ci,
-p varchar(15) character set utf8mb4
-) ENGINE= ndb DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES ('è°·å·ä¿ŠäºŒã¨ç”³ã—ã¾ã™ãŒã€ã‚¤ãƒ³ã‚¿ãƒ¼ãƒãƒƒãƒˆäºˆç´„ã®ä¼šå“¡ç™»éŒ²ã‚’ã—ã¾ã—ãŸã¨ã“ã‚ã€ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’é–“é•ãˆã¦ã—ã¾ã„会員IDãŒå—ã‘å–ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã›ã‚“ã§ã—ãŸã€‚é–“é•ãˆã‚¢ãƒ‰ãƒ¬ã‚¹ã¯tani-shun@n.vodafone.ne.jpを書ãè¾¼ã¿ã¾ã—ãŸã€‚ã©ã†ã™ã‚Œã°ã‚ˆã„ã§ã™ã‹ï¼Ÿ ãã®ä»–ã€ä½æ‰€ç­‰ã¯é–“é•ãˆã‚ã‚Šã¾ã›ã‚“。連絡ãã ã•ã„。よã‚ã—ããŠé¡˜ã„ã—ã¾ã™ã€‚m(__)m','040312-000057');
-INSERT INTO t1 VALUES ('aaa','bbb');
-SELECT length(subject) FROM t1;
-length(subject)
-3
-432
-SELECT length(subject) FROM t1 ORDER BY 1;
-length(subject)
-3
-432
-DROP TABLE t1;
-set names utf8mb4;
-create table t1 (
-a int primary key,
-b varchar(6),
-index b3(b(3))
-) engine=ndb character set=utf8mb4;
-insert into t1 values(1,'foo'),(2,'foobar');
-select * from t1 where b like 'foob%';
-a b
-2 foobar
-alter table t1 engine=innodb;
-select * from t1 where b like 'foob%';
-a b
-2 foobar
-drop table t1;
-create table t1 (
-a enum('петÑ','ваÑÑ','анюта') character set utf8mb4 not null default 'анюта',
-b set('петÑ','ваÑÑ','анюта') character set utf8mb4 not null default 'анюта'
-) engine ndb;
-create table t2 engine ndb select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from t1;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` varchar(5) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
- `b` varchar(15) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
-drop table t2;
-drop table t1;
-select 'c' like '\_' as want0;
-want0
-0
-SELECT SUBSTR('ваÑÑ',-2);
-SUBSTR('ваÑÑ',-2)
-ÑÑ
-create table t1 (id integer, a varchar(100) character set utf8mb4 collate utf8mb4_unicode_ci) engine ndb;
-insert into t1 values (1, 'Test');
-select * from t1 where soundex(a) = soundex('Test');
-id a
-1 Test
-select * from t1 where soundex(a) = soundex('TEST');
-id a
-1 Test
-select * from t1 where soundex(a) = soundex('test');
-id a
-1 Test
-drop table t1;
-select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
-soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)
-阅000
-select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
-hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB))
-E99885303030
-select soundex(_utf8mb4 0xD091D092D093);
-soundex(_utf8mb4 0xD091D092D093)
-Б000
-select hex(soundex(_utf8mb4 0xD091D092D093));
-hex(soundex(_utf8mb4 0xD091D092D093))
-D091303030
-SET collation_connection='utf8mb4_general_ci';
-create table t1 select repeat('a',4000) a;
-delete from t1;
-insert into t1 values ('a'), ('a '), ('a\t');
-select collation(a),hex(a) from t1 order by a;
-collation(a) hex(a)
-utf8mb4_general_ci 6109
-utf8mb4_general_ci 61
-utf8mb4_general_ci 6120
-drop table t1;
-select @@collation_connection;
-@@collation_connection
-utf8mb4_general_ci
-create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
-insert into t1 values('abcdef');
-insert into t1 values('_bcdef');
-insert into t1 values('a_cdef');
-insert into t1 values('ab_def');
-insert into t1 values('abc_ef');
-insert into t1 values('abcd_f');
-insert into t1 values('abcde_');
-select c1 as c1u from t1 where c1 like 'ab\_def';
-c1u
-ab_def
-select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
-c2h
-ab_def
-drop table t1;
-drop table if exists t1;
-create table t1 as select repeat(' ', 64) as s1;
-select collation(s1) from t1;
-collation(s1)
-utf8mb4_general_ci
-delete from t1;
-insert into t1 values ('a'),('ae'),(_latin1 0xE4);
-insert into t1 values ('o'),('oe'),(_latin1 0xF6);
-insert into t1 values ('s'),('ss'),(_latin1 0xDF);
-insert into t1 values ('u'),('ue'),(_latin1 0xFC);
-select s1, hex(s1) from t1 order by s1, binary s1;
-s1 hex(s1)
-a 61
-ä C3A4
-ae 6165
-o 6F
-ö C3B6
-oe 6F65
-s 73
-ß C39F
-ss 7373
-u 75
-ü C3BC
-ue 7565
-select group_concat(s1 order by binary s1) from t1 group by s1;
-group_concat(s1 order by binary s1)
-a,ä
-ae
-o,ö
-oe
-s,ß
-ss
-u,ü
-ue
-drop table t1;
-SET collation_connection='utf8mb4_bin';
-create table t1 select repeat('a',4000) a;
-delete from t1;
-insert into t1 values ('a'), ('a '), ('a\t');
-select collation(a),hex(a) from t1 order by a;
-collation(a) hex(a)
-utf8mb4_bin 6109
-utf8mb4_bin 61
-utf8mb4_bin 6120
-drop table t1;
-select @@collation_connection;
-@@collation_connection
-utf8mb4_bin
-create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
-insert into t1 values('abcdef');
-insert into t1 values('_bcdef');
-insert into t1 values('a_cdef');
-insert into t1 values('ab_def');
-insert into t1 values('abc_ef');
-insert into t1 values('abcd_f');
-insert into t1 values('abcde_');
-select c1 as c1u from t1 where c1 like 'ab\_def';
-c1u
-ab_def
-select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
-c2h
-ab_def
-drop table t1;
-CREATE TABLE t1 (
-user varchar(255) NOT NULL default ''
-) ENGINE=ndb DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES ('one'),('two');
-SELECT CHARSET('a');
-CHARSET('a')
-utf8mb4
-SELECT user, CONCAT('<', user, '>') AS c FROM t1;
-user c
-one <one>
-two <two>
-DROP TABLE t1;
-create table t1 (f1 varchar(1) not null) default charset utf8mb4 engine ndb;
-insert into t1 values (''), ('');
-select concat(concat(_latin1'->',f1),_latin1'<-') from t1;
-concat(concat(_latin1'->',f1),_latin1'<-')
--><-
--><-
-drop table t1;
-select convert(_koi8r'É' using utf8mb4) < convert(_koi8r'Ê' using utf8mb4);
-convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4)
-1
-set names latin1;
-create table t1 (a varchar(10)) character set utf8mb4 engine ndb;
-insert into t1 values ('test');
-select ifnull(a,'') from t1;
-ifnull(a,'')
-test
-drop table t1;
-select repeat(_utf8mb4'+',3) as h union select NULL;
-h
-+++
-NULL
-select ifnull(NULL, _utf8mb4'string');
-ifnull(NULL, _utf8mb4'string')
-string
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_lithuanian_ci) engine ndb;
-insert into t1 values ('I'),('K'),('Y');
-select * from t1 where s1 < 'K' and s1 = 'Y';
-s1
-I
-Y
-select * from t1 where 'K' > s1 and s1 = 'Y';
-s1
-I
-Y
-drop table t1;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_czech_ci) engine ndb;
-insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
-select * from t1 where s1 > 'd' and s1 = 'CH';
-s1
-CH
-Ch
-ch
-select * from t1 where 'd' < s1 and s1 = 'CH';
-s1
-CH
-Ch
-ch
-select * from t1 where s1 = 'cH' and s1 <> 'ch';
-s1
-cH
-select * from t1 where 'cH' = s1 and s1 <> 'ch';
-s1
-cH
-drop table t1;
-create table t1 (a varchar(255)) default character set utf8mb4 engine ndb;
-insert into t1 values (1.0);
-drop table t1;
-create table t1 (
-id int not null,
-city varchar(20) not null,
-key (city(7),id)
-) character set=utf8mb4 engine ndb;
-insert into t1 values (1,'Durban North');
-insert into t1 values (2,'Durban');
-select * from t1 where city = 'Durban';
-id city
-2 Durban
-select * from t1 where city = 'Durban ';
-id city
-2 Durban
-drop table t1;
-create table t1 (x set('A', 'B') default 0) character set utf8mb4 engine ndb;
-ERROR 42000: Invalid default value for 'x'
-create table t1 (x enum('A', 'B') default 0) character set utf8mb4 engine ndb;
-ERROR 42000: Invalid default value for 'x'
-SET NAMES UTF8;
-CREATE TABLE t1 (
-`id` int(20) NOT NULL auto_increment,
-`country` varchar(100) NOT NULL default '',
-`shortcode` varchar(100) NOT NULL default '',
-`operator` varchar(100) NOT NULL default '',
-`momid` varchar(30) NOT NULL default '',
-`keyword` varchar(160) NOT NULL default '',
-`content` varchar(160) NOT NULL default '',
-`second_token` varchar(160) default NULL,
-`gateway_id` int(11) NOT NULL default '0',
-`created` datetime NOT NULL default '0000-00-00 00:00:00',
-`msisdn` varchar(15) NOT NULL default '',
-PRIMARY KEY (`id`),
-UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`),
-KEY `IX_mobile_originated_message_keyword` (`keyword`),
-KEY `IX_mobile_originated_message_created` (`created`),
-KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`)
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4;
-INSERT INTO t1 VALUES
-(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ðд.Д имдимримрад.Ðдимримримрмдиримримримр м.Дадимфшьмримд им.Ðдимимрн имадми','ИМРИ.ÐФИМИМ.ÐЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
-(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
-CREATE TABLE t2 (
-`msisdn` varchar(15) NOT NULL default '',
-`operator_id` int(11) NOT NULL default '0',
-`created` datetime NOT NULL default '0000-00-00 00:00:00',
-UNIQUE KEY `PK_user` (`msisdn`)
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4;
-INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
-SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
-content msisdn
-ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ðд.Д имдимримрад.Ðдимримримрмдиримримримр м.Дадимфшьмримд им.Ðдимимрн имадми 1234567890
-11 g 1234567890
-DROP TABLE t1,t2;
-create table t1 (a char(20) character set utf8mb4) engine ndb;
-insert into t1 values ('123456'),('андрей');
-alter table t1 modify a char(2) character set utf8mb4;
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-Warning 1265 Data truncated for column 'a' at row 2
-select char_length(a), length(a), a from t1 order by a;
-char_length(a) length(a) a
-2 2 12
-2 4 ан
-drop table t1;
-set names utf8mb4;
-select 'andre%' like 'andreñ%' escape 'ñ';
-'andre%' like 'andreñ%' escape 'ñ'
-1
-set names utf8mb4;
-select 'a\\' like 'a\\';
-'a\\' like 'a\\'
-1
-select 'aa\\' like 'a%\\';
-'aa\\' like 'a%\\'
-1
-create table t1 (a char(10), key(a)) character set utf8mb4 engine ndb;
-insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-select * from t1 where a like "abc%";
-a
-abc
-abcd
-select * from t1 where a like concat("abc","%");
-a
-abc
-abcd
-select * from t1 where a like "ABC%";
-a
-abc
-abcd
-select * from t1 where a like "test%";
-a
-test
-select * from t1 where a like "te_t";
-a
-test
-select * from t1 where a like "%a%";
-a
-a
-abc
-abcd
-select * from t1 where a like "%abcd%";
-a
-abcd
-select * from t1 where a like "%abc\d%";
-a
-abcd
-drop table t1;
-CREATE TABLE t1 (
-a varchar(255) NOT NULL default '',
-KEY a (a)
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
-insert into t1 values (_utf8mb4 0xe880bd);
-insert into t1 values (_utf8mb4 0x5b);
-select hex(a) from t1;
-hex(a)
-5B
-E880BD
-drop table t1;
-set names 'latin1';
-create table t1 (a varchar(255)) default charset=utf8mb4 engine ndb;
-select * from t1 where find_in_set('-1', a);
-a
-drop table t1;
-create table t1 (a int) engine ndb;
-insert into t1 values (48),(49),(50);
-set names utf8mb4;
-select distinct char(a) from t1;
-char(a)
-0
-1
-2
-drop table t1;
-CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8mb4) ENGINE ndb;
-Warnings:
-Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
-INSERT INTO t1 VALUES(REPEAT('a', 100));
-CREATE TABLE t2 ENGINE ndb SELECT COALESCE(t) AS bug FROM t1;
-Warnings:
-Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
-SELECT LENGTH(bug) FROM t2;
-LENGTH(bug)
-100
-DROP TABLE t2;
-DROP TABLE t1;
-CREATE TABLE t1 (item varchar(255)) default character set utf8mb4 ENGINE ndb;
-INSERT INTO t1 VALUES (N'\\');
-INSERT INTO t1 VALUES (_utf8mb4'\\');
-INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
-INSERT INTO t1 VALUES (_utf8mb4'Cote d\'Ivoire');
-SELECT item FROM t1 ORDER BY item;
-item
-Cote d'Ivoire
-Cote d'Ivoire
-\
-\
-DROP TABLE t1;
-SET NAMES utf8mb4;
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 't1'
-CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=ndb DEFAULT CHARSET=utf8mb4;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t1 VALUES('uu');
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-INSERT INTO t1 VALUES('uU');
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-INSERT INTO t1 VALUES('uu');
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-INSERT INTO t1 VALUES('uuABC');
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-INSERT INTO t1 VALUES('UuABC');
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-INSERT INTO t1 VALUES('uuABC');
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-alter table t1 add b int;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
-delete from t1 where b=1;
-INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
-delete from t1 where b=3;
-INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
-drop table t1;
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4) engine ndb;
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_general_ci from t1 where s1 like 'ペテ%';
-before_delete_general_ci
-ペテルグル
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_general_ci from t1 where s1 like 'ペテ%';
-after_delete_general_ci
-ペテルグル
-drop table t1;
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_unicode_ci) engine ndb;
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_unicode_ci from t1 where s1 like 'ペテ%';
-before_delete_unicode_ci
-ペテルグル
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_unicode_ci from t1 where s1 like 'ペテ%';
-after_delete_unicode_ci
-ペテルグル
-drop table t1;
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_bin) engine ndb;
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_bin from t1 where s1 like 'ペテ%';
-before_delete_bin
-ペテルグル
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_bin from t1 where s1 like 'ペテ%';
-after_delete_bin
-ペテルグル
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(30) not null primary key)
-engine=ndb default character set utf8mb4 collate utf8mb4_general_ci;
-insert into t1 values ('ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã');
-insert into t1 values ('ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ');
-select a as gci1 from t1 where a like 'ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ%';
-gci1
-ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ
-select a as gci2 from t1 where a like 'ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã';
-gci2
-ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(30) not null primary key)
-engine=ndb default character set utf8mb4 collate utf8mb4_unicode_ci;
-insert into t1 values ('ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã');
-insert into t1 values ('ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ');
-select a as uci1 from t1 where a like 'ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ%';
-uci1
-ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ
-select a as uci2 from t1 where a like 'ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã';
-uci2
-ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(30) not null primary key)
-engine=ndb default character set utf8mb4 collate utf8mb4_bin;
-insert into t1 values ('ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã');
-insert into t1 values ('ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ');
-select a as bin1 from t1 where a like 'ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ%';
-bin1
-ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ
-select a as bin2 from t1 where a like 'ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã';
-bin2
-ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã
-drop table t1;
-SET NAMES utf8mb4;
-CREATE TABLE t1 (id int PRIMARY KEY,
-a varchar(16) collate utf8mb4_unicode_ci NOT NULL default '',
-b int,
-f varchar(128) default 'XXX',
-INDEX (a(4))
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-INSERT INTO t1(id, a, b) VALUES
-(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
-(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
-(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
-(10, 'eeeee', 40), (11, 'bbbbbb', 60);
-SELECT id, a, b FROM t1;
-id a b
-1 cccc 50
-10 eeeee 40
-11 bbbbbb 60
-2 cccc 70
-3 cccc 30
-4 cccc 30
-5 cccc 20
-6 bbbbbb 40
-7 dddd 30
-8 aaaa 10
-9 aaaa 50
-SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
-id a b
-11 bbbbbb 60
-6 bbbbbb 40
-8 aaaa 10
-9 aaaa 50
-SELECT id, a FROM t1 WHERE a='bbbbbb';
-id a
-11 bbbbbb
-6 bbbbbb
-SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
-id a
-6 bbbbbb
-11 bbbbbb
-DROP TABLE t1;
-SET NAMES utf8mb4;
-CREATE TABLE t1 (
-a CHAR(13) DEFAULT '',
-INDEX(a)
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES
-('Käli Käli 2-4'), ('Käli Käli 2-4'),
-('Käli Käli 2+4'), ('Käli Käli 2+4'),
-('Käli Käli 2-6'), ('Käli Käli 2-6');
-INSERT INTO t1 SELECT * FROM t1;
-CREATE TABLE t2 (
-a CHAR(13) DEFAULT '',
-INDEX(a)
-) ENGINE=ndb DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-INSERT INTO t2 VALUES
-('Kali Kali 2-4'), ('Kali Kali 2-4'),
-('Kali Kali 2+4'), ('Kali Kali 2+4'),
-('Kali Kali 2-6'), ('Kali Kali 2-6');
-INSERT INTO t2 SELECT * FROM t2;
-SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
-a
-Käli Käli 2+4
-Käli Käli 2+4
-Käli Käli 2+4
-Käli Käli 2+4
-SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
-a
-Kali Kali 2+4
-Kali Kali 2+4
-Kali Kali 2+4
-Kali Kali 2+4
-EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 53 NULL 10 Using where with pushed condition
-EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 53 const 10 Using where with pushed condition
-EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range a a 14 NULL 10 Using where with pushed condition
-EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 ref a a 14 const 10 Using where with pushed condition
-DROP TABLE t1,t2;
-CREATE TABLE t1 (
-a char(255) DEFAULT '',
-KEY(a(10))
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-a
-Käli Käli 2-4
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-a
-Käli Käli 2-4
-Käli Käli 2-4
-DROP TABLE t1;
-CREATE TABLE t1 (
-a char(255) DEFAULT ''
-) ENGINE=ndb DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-a
-Käli Käli 2-4
-Käli Käli 2-4
-ALTER TABLE t1 ADD KEY (a(10));
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-a
-Käli Käli 2-4
-Käli Käli 2-4
-DROP TABLE t1;
-SET NAMES latin2;
-create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '')
-default charset=utf8mb4 collate=utf8mb4_unicode_ci engine ndb;
-insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
-explain select distinct a from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
-SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2;
-COUNT(*)
-1
-explain select a from t1 group by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
-SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2;
-COUNT(*)
-1
-drop table t1;
-create table t1(a char(10)) default charset utf8mb4 engine ndb;
-insert into t1 values ('123'), ('456');
-explain
-select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
-1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer
-select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
-substr(Z.a,-1) a
-3 123
-6 456
-drop table t1;
-SET CHARACTER SET utf8mb4;
-SHOW VARIABLES LIKE 'character\_set\_%';
-Variable_name Value
-character_set_client utf8mb4
-character_set_connection latin1
-character_set_database latin1
-character_set_filesystem binary
-character_set_results utf8mb4
-character_set_server latin1
-character_set_system utf8
-CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
-USE crashtest;
-CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE ndb;
-INSERT INTO crashtest VALUES ('35'), ('36'), ('37');
-SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4);
-crash
-35
-36
-37
-INSERT INTO crashtest VALUES ('-1000');
-EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4);
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort
-SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4);
-crash
--1000
-35
-36
-37
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FFFFFC'
-DROP TABLE crashtest;
-DROP DATABASE crashtest;
-USE test;
-SET CHARACTER SET default;
-CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8mb4 ENGINE ndb;
-INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
-SELECT id FROM t1;
-id
-aa
-aa
-xxx
-yyy
-SELECT DISTINCT id FROM t1;
-id
-aa
-xxx
-yyy
-SELECT DISTINCT id FROM t1 ORDER BY id;
-id
-aa
-xxx
-yyy
-DROP TABLE t1;
-create table t1 (
-a varchar(26) not null
-) default character set utf8mb4 ENGINE ndb;
-insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
-select * from t1;
-a
-abcdefghijklmnopqrstuvwxyz
-alter table t1 change a a varchar(20) character set utf8mb4 not null;
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select * from t1;
-a
-abcdefghijklmnopqrst
-alter table t1 change a a char(15) character set utf8mb4 not null;
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select * from t1;
-a
-abcdefghijklmno
-alter table t1 change a a char(10) character set utf8mb4 not null;
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select * from t1;
-a
-abcdefghij
-alter table t1 change a a varchar(5) character set utf8mb4 not null;
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-select * from t1;
-a
-abcde
-drop table t1;
-set names utf8mb4;
-select hex(char(1 using utf8mb4));
-hex(char(1 using utf8mb4))
-01
-select char(0xd1,0x8f using utf8mb4);
-char(0xd1,0x8f using utf8mb4)
-select char(0xd18f using utf8mb4);
-char(0xd18f using utf8mb4)
-select char(53647 using utf8mb4);
-char(53647 using utf8mb4)
-select char(0xff,0x8f using utf8mb4);
-char(0xff,0x8f using utf8mb4)
-
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF8F'
-select convert(char(0xff,0x8f) using utf8mb4);
-convert(char(0xff,0x8f) using utf8mb4)
-
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF8F'
-set sql_mode=traditional;
-select char(0xff,0x8f using utf8mb4);
-char(0xff,0x8f using utf8mb4)
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF8F'
-select char(195 using utf8mb4);
-char(195 using utf8mb4)
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'C3'
-select char(196 using utf8mb4);
-char(196 using utf8mb4)
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'C4'
-select char(2557 using utf8mb4);
-char(2557 using utf8mb4)
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FD'
-select convert(char(0xff,0x8f) using utf8mb4);
-convert(char(0xff,0x8f) using utf8mb4)
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF8F'
-select hex(convert(char(2557 using latin1) using utf8mb4));
-hex(convert(char(2557 using latin1) using utf8mb4))
-09C3BD
-select hex(char(195));
-hex(char(195))
-C3
-select hex(char(196));
-hex(char(196))
-C4
-select hex(char(2557));
-hex(char(2557))
-09FD
-set names utf8mb4;
-create table t1 (a char(1)) default character set utf8mb4 engine ndb;
-create table t2 (a char(1)) default character set utf8mb4 engine ndb;
-insert into t1 values('a'),('a'),(0xE38182),(0xE38182);
-insert into t1 values('i'),('i'),(0xE38184),(0xE38184);
-select * from t1 union distinct select * from t2;
-a
-a
-i
-ã‚
-ã„
-drop table t1,t2;
-set names utf8mb4;
-create table t1 (a char(10), b varchar(10)) engine ndb;
-insert into t1 values ('bar','kostja');
-insert into t1 values ('kostja','bar');
-prepare my_stmt from "select * from t1 where a=?";
-set @a:='bar';
-execute my_stmt using @a;
-a b
-bar kostja
-set @a:='kostja';
-execute my_stmt using @a;
-a b
-kostja bar
-set @a:=null;
-execute my_stmt using @a;
-a b
-drop table if exists t1;
-drop table if exists t1;
-drop view if exists v1, v2;
-set names utf8mb4;
-create table t1(col1 varchar(12) character set utf8mb4 collate utf8mb4_unicode_ci) engine ndb;
-insert into t1 values('t1_val');
-create view v1 as select 'v1_val' as col1;
-select coercibility(col1), collation(col1) from v1;
-coercibility(col1) collation(col1)
-4 utf8mb4_general_ci
-create view v2 as select col1 from v1 union select col1 from t1;
-select coercibility(col1), collation(col1)from v2;
-coercibility(col1) collation(col1)
-2 utf8mb4_unicode_ci
-2 utf8mb4_unicode_ci
-drop view v1, v2;
-create view v1 as select 'v1_val' collate utf8mb4_swedish_ci as col1;
-select coercibility(col1), collation(col1) from v1;
-coercibility(col1) collation(col1)
-0 utf8mb4_swedish_ci
-create view v2 as select col1 from v1 union select col1 from t1;
-select coercibility(col1), collation(col1) from v2;
-coercibility(col1) collation(col1)
-0 utf8mb4_swedish_ci
-0 utf8mb4_swedish_ci
-drop view v1, v2;
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int) engine ndb;
-insert into t1 values ('a',1);
-select concat(a, if(b>10, N'x', N'y')) from t1;
-concat(a, if(b>10, N'x', N'y'))
-ay
-select concat(a, if(b>10, N'æ', N'ß')) from t1;
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int) engine ndb;
-insert into t1 values ('a',1);
-select concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y')) from t1;
-concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y'))
-ay
-select concat(a, if(b>10, _utf8mb4'æ', _utf8mb4'ß')) from t1;
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat'
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int) engine ndb;
-insert into t1 values ('a',1);
-select concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) from t1;
-concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79))
-ay
-select concat(a, if(b>10, _utf8mb4 0xC3A6, _utf8mb4 0xC3AF)) from t1;
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat'
-drop table t1;
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int) engine ndb;
-insert into t1 values ('a',1);
-select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
-concat(a, if(b>10, 'x' 'x', 'y' 'y'))
-ayy
-select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
-ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat'
-drop table t1;
-CREATE TABLE t1 (
-colA int(11) NOT NULL,
-colB varchar(255) character set utf8mb4 NOT NULL,
-PRIMARY KEY (colA)
-) ENGINE=ndb DEFAULT CHARSET=latin1;
-INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
-CREATE TABLE t2 (
-colA int(11) NOT NULL,
-colB varchar(255) character set utf8mb4 NOT NULL,
-KEY bad (colA,colB(3))
-) ENGINE=ndb DEFAULT CHARSET=latin1;
-INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
-SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
-WHERE t1.colA < 3;
-colA colB colA colB
-1 foo 1 foo
-2 foo bar 2 foo bar
-DROP TABLE t1, t2;
-SELECT 'н1234567890' UNION SELECT _binary '1';
-н1234567890
-н1234567890
-1
-SELECT 'н1234567890' UNION SELECT 1;
-н1234567890
-н1234567890
-1
-SELECT '1' UNION SELECT 'н1234567890';
-1
-1
-н1234567890
-SELECT 1 UNION SELECT 'н1234567890';
-1
-1
-н1234567890
-CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8mb4 ENGINE ndb;
-CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT) ENGINE ndb;
-INSERT INTO t1 (c) VALUES ('н1234567890');
-INSERT INTO t2 (b, i) VALUES ('1', 1);
-SELECT c FROM t1 UNION SELECT b FROM t2;
-c
-н1234567890
-1
-SELECT c FROM t1 UNION SELECT i FROM t2;
-c
-н1234567890
-1
-SELECT b FROM t2 UNION SELECT c FROM t1;
-b
-1
-н1234567890
-SELECT i FROM t2 UNION SELECT c FROM t1;
-i
-1
-н1234567890
-DROP TABLE t1, t2;
-set sql_mode=traditional;
-select hex(char(0xFF using utf8mb4));
-hex(char(0xFF using utf8mb4))
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF'
-select hex(convert(0xFF using utf8mb4));
-hex(convert(0xFF using utf8mb4))
-NULL
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF'
-select hex(_utf8mb4 0x616263FF);
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-select hex(_utf8mb4 X'616263FF');
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-select hex(_utf8mb4 B'001111111111');
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-select (_utf8mb4 X'616263FF');
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-set sql_mode=default;
-select hex(char(0xFF using utf8mb4));
-hex(char(0xFF using utf8mb4))
-
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF'
-select hex(convert(0xFF using utf8mb4));
-hex(convert(0xFF using utf8mb4))
-
-Warnings:
-Warning 1300 Invalid utf8mb4 character string: 'FF'
-select hex(_utf8mb4 0x616263FF);
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-select hex(_utf8mb4 X'616263FF');
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-select hex(_utf8mb4 B'001111111111');
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-select (_utf8mb4 X'616263FF');
-ERROR HY000: Invalid utf8mb4 character string: 'FF'
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE ndb;
-INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-CONVERT(a, CHAR) CONVERT(b, CHAR)
-70000 1092
-70001 1085
-70002 1065
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
-CONVERT(a, CHAR) CONVERT(b, CHAR)
-70000 1092
-70001 1085
-70002 1065
-ALTER TABLE t1 ADD UNIQUE (b);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-CONVERT(a, CHAR) CONVERT(b, CHAR)
-70000 1092
-70001 1085
-70002 1065
-DROP INDEX b ON t1;
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-CONVERT(a, CHAR) CONVERT(b, CHAR)
-70000 1092
-70001 1085
-70002 1065
-ALTER TABLE t1 ADD INDEX (b);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
-CONVERT(a, CHAR) CONVERT(b, CHAR)
-70000 1092
-70001 1085
-70002 1065
-DROP TABLE t1;
-#
-# Bug#26474: Add Sinhala script (Sri Lanka) collation to MySQL
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-predicted_order int NOT NULL,
-utf8mb4_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb4 ENGINE ndb;
-INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17, x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682');
-SELECT predicted_order, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_sinhala_ci;
-predicted_order hex(utf8mb4_encoding)
-1 E0B7B4
-2 E0B685
-3 E0B686
-4 E0B687
-5 E0B688
-6 E0B689
-7 E0B68A
-8 E0B68B
-9 E0B68C
-10 E0B68D
-11 E0B68E
-12 E0B68F
-13 E0B690
-14 E0B691
-15 E0B692
-16 E0B693
-17 E0B694
-18 E0B695
-19 E0B696
-20 E0B682
-21 E0B683
-22 E0B69A
-23 E0B69AE0B78F
-24 E0B69AE0B790
-25 E0B69AE0B791
-26 E0B69AE0B792
-27 E0B69AE0B793
-28 E0B69AE0B794
-29 E0B69AE0B796
-30 E0B69AE0B798
-31 E0B69AE0B7B2
-32 E0B69AE0B79F
-33 E0B69AE0B7B3
-34 E0B69AE0B799
-35 E0B69AE0B79A
-36 E0B69AE0B79B
-37 E0B69AE0B79C
-38 E0B69AE0B79D
-39 E0B69AE0B79E
-40 E0B69AE0B78A
-41 E0B69B
-42 E0B69C
-43 E0B69D
-44 E0B69E
-45 E0B69F
-46 E0B6A0
-47 E0B6A1
-48 E0B6A2
-49 E0B6A3
-50 E0B6A5
-51 E0B6A4
-52 E0B6A6
-53 E0B6A7
-54 E0B6A8
-55 E0B6A9
-56 E0B6AA
-57 E0B6AB
-58 E0B6AC
-59 E0B6AD
-60 E0B6AE
-61 E0B6AF
-62 E0B6B0
-63 E0B6B1
-64 E0B6B3
-65 E0B6B4
-66 E0B6B5
-67 E0B6B6
-68 E0B6B7
-69 E0B6B8
-70 E0B6B9
-71 E0B6BA
-72 E0B6BB
-73 E0B6BBE0B78AE2808D
-74 E0B6BD
-75 E0B780
-76 E0B781
-77 E0B782
-78 E0B783
-79 E0B784
-80 E0B785
-81 E0B786
-82 E0B78F
-83 E0B790
-84 E0B791
-85 E0B792
-86 E0B793
-87 E0B794
-88 E0B796
-89 E0B798
-90 E0B7B2
-91 E0B79F
-92 E0B7B3
-93 E0B799
-94 E0B79A
-95 E0B79B
-96 E0B79C
-97 E0B79D
-98 E0B79E
-99 E0B78A
-100 E0B78AE2808DE0B6BA
-101 E0B78AE2808DE0B6BB
-DROP TABLE t1;
-#
-# Bug#32914 Character sets: illegal characters in utf8mb4 and utf32 columns
-#
-create table t1 (utf8mb4 char(1) character set utf8mb4) engine ndb;
-Testing [F0][90..BF][80..BF][80..BF]
-insert into t1 values (0xF0908080);
-insert into t1 values (0xF0BFBFBF);
-insert into t1 values (0xF08F8080);
-Warnings:
-Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1
-select hex(utf8mb4) from t1;
-hex(utf8mb4)
-
-F0908080
-F0BFBFBF
-delete from t1;
-Testing [F2..F3][80..BF][80..BF][80..BF]
-insert into t1 values (0xF2808080);
-insert into t1 values (0xF2BFBFBF);
-select hex(utf8mb4) from t1;
-hex(utf8mb4)
-F2808080
-F2BFBFBF
-delete from t1;
-Testing [F4][80..8F][80..BF][80..BF]
-insert into t1 values (0xF4808080);
-insert into t1 values (0xF48F8080);
-insert into t1 values (0xF4908080);
-Warnings:
-Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1
-select hex(utf8mb4) from t1;
-hex(utf8mb4)
-
-F4808080
-F48F8080
-drop table t1;
-#
-# Check strnxfrm() with odd length
-#
-set max_sort_length=5;
-select @@max_sort_length;
-@@max_sort_length
-5
-create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine ndb;
-insert into t1 values ('a'),('b'),('c');
-select * from t1 order by a;
-a
-a
-b
-c
-alter table t1 modify a varchar(128) character set utf8mb4 collate utf8mb4_bin;
-select * from t1 order by a;
-a
-a
-b
-c
-drop table t1;
-set max_sort_length=default;
-#
-# Bug#26180: Can't add columns to tables created with utf8mb4 text indexes
-#
-#
-# Testing 4-byte values.
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-u_decimal int NOT NULL,
-utf8mb4_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb4 ENGINE ndb;
-INSERT INTO t1 VALUES (119040, x'f09d8480'),
-# G CLEF
-(119070, x'f09d849e'),
-# HALF NOTE
-(119134, x'f09d859e'),
-# MUSICAL SYMBOL CROIX
-(119247, x'f09d878f'),
-# MATHEMATICAL BOLD ITALIC CAPITAL DELTA
-(120607, x'f09d9c9f'),
-# SANS-SERIF BOLD ITALIC CAPITAL PI
-(120735, x'f09d9e9f'),
-# <Plane 16 Private Use, Last> (last 4 byte character)
-(1114111, x'f48fbfbf'),
-# VARIATION SELECTOR-256
-(917999, x'f3a087af');
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480');
-INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab');
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
-Warnings:
-Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1
-SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
-u_decimal hex(utf8mb4_encoding)
-1114111 F48FBFBF
-119040 F09D8480
-119070 F09D849E
-119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
-119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
-119134 F09D859E
-119247 F09D878F
-120607 F09D9C9F
-120735 F09D9E9F
-65131 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB
-917999 F3A087AF
-INSERT INTO t1 VALUES (1114111, x'f5808080');
-Warnings:
-Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1
-SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
-table_name= 't1' AND column_name= 'utf8mb4_encoding';
-character_maximum_length character_octet_length
-10 40
-DROP TABLE IF EXISTS t2;
-CREATE TABLE t2 (
-u_decimal int NOT NULL,
-utf8mb3_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb3 ENGINE ndb;
-INSERT INTO t2 VALUES (42856, x'ea9da8');
-INSERT INTO t2 VALUES (65131, x'efb9ab');
-INSERT INTO t2 VALUES (1114111, x'f48fbfbf');
-Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1
-SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
-table_name= 't2' AND column_name= 'utf8mb3_encoding';
-character_maximum_length character_octet_length
-10 30
-UPDATE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
-Warnings:
-Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1
-UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
-SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1;
-HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8'))
-EA9DA8
-EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8
-F09D8480EA9DA8
-F09D849EEA9DA8
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8
-F09D859EEA9DA8
-F09D878FEA9DA8
-F09D9C9FEA9DA8
-F09D9E9FEA9DA8
-F3A087AFEA9DA8
-F48FBFBFEA9DA8
-SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2;
-HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding))
-
-EA9DA8
-EFB9AB
-EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB
-EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8
-EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB
-F09D8480
-F09D8480EA9DA8
-F09D8480EFB9AB
-F09D849E
-F09D849EEA9DA8
-F09D849EEFB9AB
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB
-F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB
-F09D859E
-F09D859EEA9DA8
-F09D859EEFB9AB
-F09D878F
-F09D878FEA9DA8
-F09D878FEFB9AB
-F09D9C9F
-F09D9C9FEA9DA8
-F09D9C9FEFB9AB
-F09D9E9F
-F09D9E9FEA9DA8
-F09D9E9FEFB9AB
-F3A087AF
-F3A087AFEA9DA8
-F3A087AFEFB9AB
-F48FBFBF
-F48FBFBFEA9DA8
-F48FBFBFEFB9AB
-SELECT count(*) FROM t1, t2
-WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
-count(*)
-33
-ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `u_decimal` int(11) NOT NULL,
- `utf8mb4_encoding` varchar(10) NOT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=utf8
-SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1;
-u_decimal hex(utf8mb4_encoding) utf8mb4_encoding
-1114111
-1114111 3F ?
-119040 3F ?
-119070 3F ?
-119070 3F3F3F3F3F3F3F3F3F3F ??????????
-119070 3F3F3F3F3F3F3F3F3F3F ??????????
-119134 3F ?
-119247 3F ?
-120607 3F ?
-120735 3F ?
-65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB ﹫?????﹫﹫?﹫
-917999 3F ?
-ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb4;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `u_decimal` int(11) NOT NULL,
- `utf8mb3_encoding` varchar(10) NOT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4
-SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
-u_decimal hex(utf8mb3_encoding)
-1114111
-42856 EA9DA8
-65131 EFB9AB
-ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `u_decimal` int(11) NOT NULL,
- `utf8mb3_encoding` varchar(10) NOT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=utf8
-SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
-u_decimal hex(utf8mb3_encoding)
-1114111
-42856 EA9DA8
-65131 EFB9AB
-ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `u_decimal` int(11) NOT NULL,
- `utf8mb4_encoding` varchar(10) DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=utf8
-SELECT u_decimal,hex(utf8mb4_encoding) FROM t1;
-u_decimal hex(utf8mb4_encoding)
-1114111
-1114111 3F
-119040 3F
-119070 3F
-119070 3F3F3F3F3F3F3F3F3F3F
-119070 3F3F3F3F3F3F3F3F3F3F
-119134 3F
-119247 3F
-120607 3F
-120735 3F
-65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB
-917999 3F
-ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb4;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `u_decimal` int(11) NOT NULL,
- `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=utf8
-SELECT u_decimal,hex(utf8mb4_encoding) FROM t1;
-u_decimal hex(utf8mb4_encoding)
-1114111
-1114111 3F
-119040 3F
-119070 3F
-119070 3F3F3F3F3F3F3F3F3F3F
-119070 3F3F3F3F3F3F3F3F3F3F
-119134 3F
-119247 3F
-120607 3F
-120735 3F
-65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB
-917999 3F
-ALTER TABLE t2 MODIFY utf8mb3_encoding VARCHAR(10) CHARACTER SET utf8mb4;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `u_decimal` int(11) NOT NULL,
- `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=utf8
-SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
-u_decimal hex(utf8mb3_encoding)
-1114111
-42856 EA9DA8
-65131 EFB9AB
-DROP TABLE IF EXISTS t3;
-CREATE TABLE t3 (
-u_decimal int NOT NULL,
-utf8mb3_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8 ENGINE ndb;
-INSERT INTO t3 SELECT * FROM t1;
-DROP TABLE IF EXISTS t4;
-CREATE TABLE t4 (
-u_decimal int NOT NULL,
-utf8mb4_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb4 ENGINE ndb;
-INSERT INTO t3 SELECT * FROM t2;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP TABLE t4;
-#
-# Testing that mixing utf8 and utf8mb4 collations returns utf8mb4
-#
-SELECT CHARSET(CONCAT(_utf8mb4'a',_utf8'b'));
-CHARSET(CONCAT(_utf8mb4'a',_utf8'b'))
-utf8mb4
-CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL) ENGINE ndb;
-INSERT INTO t1 VALUES (x'ea9da8'),(x'f48fbfbf');
-SELECT CONCAT(utf8mb4, _utf8 x'ea9da8') FROM t1 LIMIT 0;
-CONCAT(utf8mb4, _utf8 x'ea9da8')
-CREATE TABLE t2 (utf8mb3 VARCHAR(10) CHARACTER SET utf8mb3 NOT NULL) ENGINE ndb;
-INSERT INTO t2 VALUES (x'ea9da8');
-SELECT HEX(CONCAT(utf8mb4, utf8mb3)) FROM t1,t2 ORDER BY 1;
-HEX(CONCAT(utf8mb4, utf8mb3))
-EA9DA8EA9DA8
-F48FBFBFEA9DA8
-SELECT CHARSET(CONCAT(utf8mb4, utf8mb3)) FROM t1, t2 LIMIT 1;
-CHARSET(CONCAT(utf8mb4, utf8mb3))
-utf8mb4
-SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
-utf8mb4 utf8mb3
-ô¿¿ ê¨
-SELECT * FROM t1, t2 WHERE t1.utf8mb4 = t2.utf8mb3;
-utf8mb4 utf8mb3
-ê¨ ê¨
-SELECT * FROM t1, t2 WHERE t1.utf8mb4 < t2.utf8mb3;
-utf8mb4 utf8mb3
-DROP TABLE t1;
-DROP TABLE t2;
-#
-# Check that mixing utf8mb4 with an invalid utf8 constant returns error
-#
-CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4) ENGINE ndb;
-INSERT INTO t1 VALUES (x'f48fbfbf');
-SELECT CONCAT(utf8mb4, _utf8 '¿') FROM t1;
-ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat'
-SELECT CONCAT('a', _utf8 '¿') FROM t1;
-ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (utf8_general_ci,COERCIBLE) for operation 'concat'
-DROP TABLE t1;
-#
-# End of 5.5 tests
-#
-#
-# End of tests
-#
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 432b9b14a85..b6081d34f37 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -544,3 +544,17 @@ SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
valid_date
Thursday 01 January 2009
"End of 5.0 tests"
+#
+# Start of 5.1 tests
+#
+#
+# Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
+#
+SET NAMES utf8;
+SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)));
+LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)))
+%
+SET NAMES latin1;
+#
+# End of 5.1 tests
+#
diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result
index 2282f65c456..352f421eda7 100644
--- a/mysql-test/r/ddl_i18n_koi8r.result
+++ b/mysql-test/r/ddl_i18n_koi8r.result
@@ -724,7 +724,7 @@ utf8_general_ci utf8_general_ci
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest1`;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -757,8 +757,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -791,7 +791,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql
@@ -800,7 +800,7 @@ ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest2`;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -833,8 +833,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -867,7 +867,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql
@@ -1742,7 +1742,7 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (1),(0),(1);
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1770,8 +1770,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1799,7 +1799,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql
@@ -1821,7 +1821,7 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (1),(0),(1);
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1849,8 +1849,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1878,7 +1878,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql
@@ -2486,7 +2486,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER
USE `mysqltest1`;
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2512,9 +2512,9 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2540,7 +2540,7 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
@@ -2553,7 +2553,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER
USE `mysqltest2`;
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2579,9 +2579,9 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2607,7 +2607,7 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result
index 9d27fdb22bb..1385612fc32 100644
--- a/mysql-test/r/ddl_i18n_utf8.result
+++ b/mysql-test/r/ddl_i18n_utf8.result
@@ -724,7 +724,7 @@ utf8_general_ci utf8_general_ci
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest1`;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -757,8 +757,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -791,7 +791,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql
@@ -800,7 +800,7 @@ ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest2`;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -833,8 +833,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -867,7 +867,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql
@@ -1742,7 +1742,7 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (1),(0),(1);
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1770,8 +1770,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1799,7 +1799,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql
@@ -1821,7 +1821,7 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (1),(0),(1);
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1849,8 +1849,8 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
@@ -1878,7 +1878,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql
@@ -2486,7 +2486,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER
USE `mysqltest1`;
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2512,9 +2512,9 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;;
-ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2540,7 +2540,7 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
@@ -2553,7 +2553,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER
USE `mysqltest2`;
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2579,9 +2579,9 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;;
-ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
@@ -2607,7 +2607,7 @@ END */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection = @saved_col_connection */ ;;
-ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;;
+ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 8c071cca396..0eb0661b0e2 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -422,7 +422,47 @@ COMMIT;
UNLOCK TABLES;
# Connection con1
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
+# Connection default
+# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
+# This test has triggered some asserts in metadata locking
+# subsystem at some point in time..
+LOCK TABLE t1 WRITE;
+INSERT DELAYED INTO t2 VALUES (7);
+UNLOCK TABLES;
+SET AUTOCOMMIT= 0;
+LOCK TABLE t1 WRITE;
+INSERT DELAYED INTO t2 VALUES (8);
+UNLOCK TABLES;
+SET AUTOCOMMIT= 1;
# Connection con2
# Connection con1
# Connection default
DROP TABLE t1, t2, t3;
+#
+# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
+#
+drop table if exists t1, t2, tm;
+create table t1(a int);
+create table t2(a int);
+create table tm(a int) engine=merge union=(t1, t2);
+begin;
+select * from t1;
+a
+# Connection 'con1'.
+# Sending:
+alter table t1 comment 'test';
+# Connection 'default'.
+# Wait until ALTER TABLE blocks and starts waiting
+# for connection 'default'. It should wait with a
+# pending SNW lock on 't1'.
+# Attempt to perform delayed insert into 'tm' should not lead
+# to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should
+# be emitted.
+insert delayed into tm values (1);
+ERROR HY000: DELAYED option not supported for table 'tm'
+# Unblock ALTER TABLE.
+commit;
+# Connection 'con1'.
+# Reaping ALTER TABLE:
+# Connection 'default'.
+drop tables tm, t1, t2;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 702b9348b7d..5e4adbbd6dc 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -509,3 +509,18 @@ CREATE TABLE t3 LIKE t1;
DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
DROP TABLE t1, t2, t3;
End of 5.1 tests
+#
+# Bug#51099 Assertion in mysql_multi_delete_prepare()
+#
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1, v2;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(b INT);
+CREATE VIEW v1 AS SELECT a, b FROM t1, t2;
+CREATE VIEW v2 AS SELECT a FROM v1;
+DELETE FROM v2;
+ERROR HY000: Can not delete from join view 'test.v2'
+DELETE v2 FROM v2;
+ERROR HY000: Can not delete from join view 'test.v2'
+DROP VIEW v2, v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 53cd89c13c1..a86eabc3192 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -400,4 +400,30 @@ SELECT 0 FROM
(SELECT 0) t61;
0
0
+#
+# A nested materialized derived table is used before being populated.
+# (addon for bug#19077)
+#
+CREATE TABLE t1 (i INT, j BIGINT);
+INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
+SELECT * FROM (SELECT MIN(i) FROM t1
+WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3;
+MIN(i)
+1
+DROP TABLE t1;
# End of 5.0 tests
+#
+# Bug#58730 Assertion failed: table->key_read == 0 in close_thread_table,
+# temptable views
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, KEY (b));
+INSERT INTO t1 VALUES (1),(1);
+INSERT INTO t2 VALUES (1),(1);
+CREATE algorithm=temptable VIEW v1 AS
+SELECT 1 FROM t1 LEFT JOIN t1 t3 ON 1 > (SELECT 1 FROM t1);
+CREATE algorithm=temptable VIEW v2 AS SELECT 1 FROM t2;
+EXPLAIN SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2);
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, t2;
+DROP VIEW v1, v2;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index ee8f9f897ad..041ee3e72cd 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -794,3 +794,14 @@ DROP TABLE t1;
SET @@sort_buffer_size = @old_sort_buffer_size;
SET @@max_heap_table_size = @old_max_heap_table_size;
End of 5.1 tests
+#
+# Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
+#
+CREATE TABLE t1 (a INT(1), b INT(1));
+INSERT INTO t1 VALUES (1111, 2222), (3333, 4444);
+SELECT DISTINCT CONCAT(a,b) AS c FROM t1 ORDER BY 1;
+c
+11112222
+33334444
+DROP TABLE t1;
+End of 5.5 tests
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index 3d247a242a3..e6a1b492b39 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -134,3 +134,15 @@ INSERT INTO t1 VALUES ('abc\0\0');
INSERT INTO t1 VALUES ('abc\0\0');
ERROR 23000: Duplicate entry 'abc\x00\x00' for key 'PRIMARY'
DROP TABLE t1;
+#
+# Bug#57882: Item_func_conv_charset::val_str(String*):
+# Assertion `fixed == 1' failed
+#
+SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
+ERROR 22003: DOUBLE value is out of range in 'cot('v')'
+SET NAMES utf8 COLLATE utf8_latvian_ci ;
+SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
+ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))'
+#
+# End Bug#57882
+#
diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result
index e068158e6ce..29e81975c87 100644
--- a/mysql-test/r/events_1.result
+++ b/mysql-test/r/events_1.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
drop database if exists events_test;
drop database if exists db_x;
drop database if exists mysqltest_db2;
@@ -259,33 +260,36 @@ events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLE
Try to alter mysql.event: the server should fail to load
event information after mysql.event was tampered with.
-First, let's add a column to the end and make sure everything
-works as before
+First, let's add a column to the end and check the error is emitted.
ALTER TABLE mysql.event ADD dummy INT;
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
-events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+ERROR HY000: Failed to open mysql.event
SELECT event_name FROM INFORMATION_SCHEMA.events;
-event_name
-intact_check
+ERROR HY000: Failed to open mysql.event
SHOW CREATE EVENT intact_check;
-Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
-intact_check SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `intact_check` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT "nothing" latin1 latin1_swedish_ci latin1_swedish_ci
+ERROR HY000: Failed to open mysql.event
DROP EVENT no_such_event;
-ERROR HY000: Unknown event 'no_such_event'
+ERROR HY000: Failed to open mysql.event
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_1;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_2;
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check;
+ERROR HY000: Failed to open mysql.event
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
+Warnings:
+Error 1545 Failed to open mysql.event
SELECT @@event_scheduler;
@@event_scheduler
OFF
@@ -294,6 +298,7 @@ Variable_name Value
event_scheduler OFF
SET GLOBAL event_scheduler=OFF;
ALTER TABLE mysql.event DROP dummy;
+DROP EVENT intact_check;
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
Now let's add a column to the first position: the server
@@ -301,30 +306,32 @@ expects to see event schema name there
ALTER TABLE mysql.event ADD dummy INT FIRST;
SHOW EVENTS;
-ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+ERROR HY000: Failed to open mysql.event
SELECT event_name FROM INFORMATION_SCHEMA.events;
-ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+ERROR HY000: Failed to open mysql.event
SHOW CREATE EVENT intact_check;
-ERROR HY000: Unknown event 'intact_check'
+ERROR HY000: Failed to open mysql.event
DROP EVENT no_such_event;
-ERROR HY000: Unknown event 'no_such_event'
+ERROR HY000: Failed to open mysql.event
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
-ERROR HY000: Failed to store event name. Error code 2 from storage engine.
+ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_1;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_2;
-ERROR HY000: Unknown event 'intact_check_2'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check;
-ERROR HY000: Unknown event 'intact_check'
+ERROR HY000: Failed to open mysql.event
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
+Warnings:
+Error 1545 Failed to open mysql.event
SELECT @@event_scheduler;
@@event_scheduler
OFF
@@ -345,29 +352,32 @@ Drop some columns and try more checks.
ALTER TABLE mysql.event DROP comment, DROP starts;
SHOW EVENTS;
-ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+ERROR HY000: Failed to open mysql.event
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
-ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+ERROR HY000: Failed to open mysql.event
SHOW CREATE EVENT intact_check;
-ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
+ERROR HY000: Failed to open mysql.event
DROP EVENT no_such_event;
-ERROR HY000: Unknown event 'no_such_event'
+ERROR HY000: Failed to open mysql.event
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
-ERROR HY000: Column count of mysql.event is wrong. Expected 22, found 20. The table is probably corrupted
+ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_1;
-ERROR HY000: Unknown event 'intact_check_1'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_2;
-ERROR HY000: Unknown event 'intact_check_2'
+ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check;
+ERROR HY000: Failed to open mysql.event
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
+Warnings:
+Error 1545 Failed to open mysql.event
SELECT @@event_scheduler;
@@event_scheduler
OFF
@@ -425,4 +435,42 @@ CREATE TABLE mysql.event like event_like;
DROP TABLE event_like;
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
+
+#
+# Bug#12394306: the sever may crash if mysql.event is corrupted
+#
+
+CREATE EVENT ev1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ALTER EVENT ev1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
+
+CREATE TABLE event_original LIKE mysql.event;
+INSERT INTO event_original SELECT * FROM mysql.event;
+
+ALTER TABLE mysql.event MODIFY modified CHAR(1);
+Warnings:
+Warning 1265 Data truncated for column 'modified' at row 1
+
+SHOW EVENTS;
+ERROR HY000: Failed to open mysql.event
+
+SELECT event_name, created, last_altered FROM information_schema.events;
+ERROR HY000: Failed to open mysql.event
+
+CREATE EVENT ev2 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
+ERROR HY000: Failed to open mysql.event
+
+ALTER EVENT ev1 ON SCHEDULE EVERY 9 HOUR DO SELECT 9;
+ERROR HY000: Failed to open mysql.event
+
+DROP TABLE mysql.event;
+RENAME TABLE event_original TO mysql.event;
+
+DROP EVENT ev1;
+
+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
+
+#
+# End of tests
+#
drop database events_test;
diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result
index 530d8559f11..66ec00d7357 100644
--- a/mysql-test/r/events_2.result
+++ b/mysql-test/r/events_2.result
@@ -133,15 +133,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 write;
show create event e1;
@@ -151,15 +151,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was not locked with LOCK TABLES
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 read, mysql.event read;
show create event e1;
@@ -169,15 +169,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 write, mysql.event read;
show create event e1;
@@ -187,15 +187,15 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e2;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
-ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
lock table t1 read, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
@@ -209,11 +209,17 @@ select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 disable;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
alter event e2 rename to e3;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e3;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
drop event e1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
+drop event e1;
Make sure we have left no events
select event_name from information_schema.events;
event_name
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index 7b5b53210ea..b98d1674a3c 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -419,7 +419,7 @@ SET TIME_ZONE= '+04:00';
ALTER EVENT e1 DO SELECT 2;
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
-events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT e1;
SET TIME_ZONE='+05:00';
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
@@ -535,6 +535,7 @@ DROP EVENT e3;
DROP EVENT e2;
DROP EVENT e1;
SET TIME_ZONE=@save_time_zone;
+SET TIMESTAMP=DEFAULT;
drop event if exists new_event;
CREATE EVENT new_event ON SCHEDULE EVERY 0 SECOND DO SELECT 1;
ERROR HY000: INTERVAL is either not positive or too big
@@ -568,6 +569,7 @@ USE test;
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
SET GLOBAL event_scheduler = ON;
CREATE TABLE events_test.event_log
(id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp)
@@ -745,6 +747,68 @@ event_name originator
ev1 4294967295
DROP EVENT ev1;
SET GLOBAL server_id = @old_server_id;
+CREATE DATABASE event_test12;
+USE event_test12;
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+CREATE DATABASE event_test1;
+USE event_test1;
+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
+DROP DATABASE event_test1;
+DROP DATABASE event_test12;
+#
+# Bug#12546938 (formerly known as bug#61005):
+# CREATE IF NOT EXIST EVENT WILL CREATE MULTIPLE RUNNING EVENTS
+#
+USE events_test;
+SET GLOBAL event_scheduler = ON;
+DROP TABLE IF EXISTS table_bug12546938;
+DROP EVENT IF EXISTS event_Bug12546938;
+CREATE TABLE table_bug12546938 (i INT);
+# Create an event which will be executed with a small delay
+# and won't be automatically dropped after that.
+CREATE EVENT event_Bug12546938
+ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
+ENABLE DO
+BEGIN
+INSERT INTO table_bug12546938 VALUES(1);
+END
+|
+# Now try to create the same event using CREATE EVENT IF NOT EXISTS.
+# A warning should be emitted. A new event should not be created nor
+# the old event should be re-executed.
+CREATE EVENT IF NOT EXISTS event_bug12546938
+ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
+ENABLE DO
+BEGIN
+INSERT INTO table_bug12546938 VALUES (1);
+END
+|
+Warnings:
+Note 1537 Event 'event_bug12546938' already exists
+# Wait until at least one instance of event is executed.
+# Check that only one instance of our event was executed.
+SELECT COUNT(*) FROM table_bug12546938;
+COUNT(*)
+1
+# Clean-up.
+DROP EVENT IF EXISTS event_Bug12546938;
+DROP TABLE table_bug12546938;
+SET GLOBAL EVENT_SCHEDULER = OFF;
+DROP DATABASE IF EXISTS event_test11764334;
+CREATE DATABASE event_test11764334;
+USE event_test11764334;
+CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
+SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 4 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+DROP EVENT ev1;
+DROP DATABASE event_test11764334;
+USE test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert;
diff --git a/mysql-test/r/events_restart.result b/mysql-test/r/events_restart.result
index 4db61d357ce..6a751fa29f8 100644
--- a/mysql-test/r/events_restart.result
+++ b/mysql-test/r/events_restart.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
set global event_scheduler=off;
drop database if exists events_test;
create database events_test;
@@ -52,6 +53,8 @@ Warnings:
Note 1008 Can't drop database 'mysqltest_database_not_exists'; database doesn't exist
create database mysqltest_db1;
drop database mysqltest_db1;
+Warnings:
+Error 1545 Failed to open mysql.event
Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index fc8c2ffcaf7..81072bde24c 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -180,7 +180,6 @@ ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP col
SHOW WARNINGS;
Level Code Message
Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
-Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
SET SESSION sql_mode=@old_sql_mode;
DROP TABLE t1;
End of 5.0 tests.
@@ -271,4 +270,64 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c2,c2_2 c2 10 const,const 3 Using where
DROP TABLE t1;
+#
+# Bug#56814 Explain + subselect + fulltext crashes server
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
+FULLTEXT KEY(f1),UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+EXECUTE stmt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+2 SUBQUERY a system NULL NULL NULL NULL 1 Using filesort
+2 SUBQUERY t1 fulltext f1 f1 0 1 Using where
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.1 tests.
+#
+# Bug#11829785 EXPLAIN EXTENDED CRASH WITH RIGHT OUTER JOIN, SUBQUERIES
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0), (0);
+PREPARE s FROM
+'EXPLAIN EXTENDED
+SELECT SUBSTRING(1, (SELECT 1 FROM t1 a1 RIGHT OUTER JOIN t1 ON 0)) AS d
+FROM t1 WHERE 0 > ANY (SELECT @a FROM t1)';
+EXECUTE s;
+ERROR 21000: Subquery returns more than 1 row
+DEALLOCATE PREPARE s;
+DROP TABLE t1;
+#
diff --git a/mysql-test/r/file_contents.result b/mysql-test/r/file_contents.result
new file mode 100644
index 00000000000..110769e12f8
--- /dev/null
+++ b/mysql-test/r/file_contents.result
@@ -0,0 +1,6 @@
+
+Checking 'INFO_SRC' and 'INFO_BIN'
+INFO_SRC: Found MySQL version number / Found BZR revision id
+INFO_BIN: Found 'Compiler ... used' line / Found 'Feature flags' line
+
+End of tests
diff --git a/mysql-test/r/filesort_debug.result b/mysql-test/r/filesort_debug.result
new file mode 100644
index 00000000000..c35a6753353
--- /dev/null
+++ b/mysql-test/r/filesort_debug.result
@@ -0,0 +1,33 @@
+SET @old_debug= @@session.debug;
+#
+# Bug#36022 please log more information about "Sort aborted" queries
+#
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
+INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
+SET session debug= '+d,make_char_array_fail';
+CALL mtr.add_suppression("Out of sort memory");
+SELECT * FROM t1 ORDER BY f1 ASC, f0;
+ERROR HY001: Out of sort memory, consider increasing server sort buffer size
+SET session debug= @old_debug;
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
+ERROR 42000: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1
+DROP TABLE t1;
+DROP FUNCTION f1;
+#
+# Bug #11747102
+# 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES
+#
+# connection 1
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
+INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
+SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed';
+# Sending: (not reaped since connection is killed later)
+SELECT * FROM t1 ORDER BY f1 ASC, f0;
+# connection 2
+SET DEBUG_SYNC='now WAIT_FOR filesort_started';
+KILL @id;
+SET DEBUG_SYNC='now SIGNAL filesort_killed';
+# connection default
+SET DEBUG_SYNC= "RESET";
+DROP TABLE t1;
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index aee18d91edf..bbfea2dade8 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -373,3 +373,96 @@ commit;
# --> connection con2
# --> connection default
drop table t1;
+#
+# Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table
+# causes assert failure".
+#
+drop table if exists t1, t2, tm;
+create table t1 (i int);
+create table t2 (i int);
+create table tm (i int) engine=merge union=(t1, t2);
+insert into t1 values (1), (2);
+insert into t2 values (3), (4);
+# The below statement should succeed and lock merge
+# table for read. Only merge table gets flushed and
+# not underlying tables.
+flush tables tm with read lock;
+select * from tm;
+i
+1
+2
+3
+4
+# Check that underlying tables are locked.
+select * from t1;
+i
+1
+2
+select * from t2;
+i
+3
+4
+unlock tables;
+# This statement should succeed as well and flush
+# all tables in the list.
+flush tables tm, t1, t2 with read lock;
+select * from tm;
+i
+1
+2
+3
+4
+# Naturally, underlying tables should be locked in this case too.
+select * from t1;
+i
+1
+2
+select * from t2;
+i
+3
+4
+unlock tables;
+drop tables tm, t1, t2;
+#
+# Test for bug #57006 "Deadlock between HANDLER and
+# FLUSH TABLES WITH READ LOCK".
+#
+drop table if exists t1, t2;
+create table t1 (i int);
+create table t2 (i int);
+handler t1 open;
+# Switching to connection 'con1'.
+# Sending:
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL starts waiting for 't1' to be closed.
+# Switching to connection 'default'.
+# The below statement should not cause deadlock.
+# Sending:
+insert into t2 values (1);
+# Switching to connection 'con2'.
+# Wait until INSERT starts to wait for FTWRL to go away.
+# Switching to connection 'con1'.
+# FTWRL should be able to continue now.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+# Reap INSERT.
+handler t1 close;
+# Cleanup.
+drop tables t1, t2;
+#
+# Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads
+# to assert failure.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+FLUSH TABLES t1 WITH READ LOCK;
+FLUSH TABLES;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+ALTER TABLE t1 COMMENT 'test';
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/r/flush_read_lock.result b/mysql-test/r/flush_read_lock.result
new file mode 100644
index 00000000000..cd7083405bf
--- /dev/null
+++ b/mysql-test/r/flush_read_lock.result
@@ -0,0 +1,1684 @@
+# FTWRL takes two global metadata locks -- a global shared
+# metadata lock and the commit blocker lock.
+# The first lock prevents DDL from taking place.
+# Let's say that all DDL statements that take metadata
+# locks form class #1 -- incompatible with FTWRL because
+# take incompatible MDL table locks.
+# The first global lock doesn't, however, prevent standalone
+# COMMITs (or implicit COMMITs) from taking place, since a
+# COMMIT doesn't take table locks. It doesn't prevent
+# DDL on temporary tables either, since they don't
+# take any table locks either.
+# Most DDL statements do not perform an implicit commit
+# if operate on a temporary table. Examples are CREATE
+# TEMPORARY TABLE and DROP TEMPORARY TABLE.
+# Thus, these DDL statements can go through in presence
+# of FTWRL. This is class #2 -- compatible because
+# do not take incompatible MDL locks and do not issue
+# implicit commit..
+# (Although these operations do not commit, their effects
+# cannot be rolled back either.)
+# ALTER TABLE, ANALYZE, OPTIMIZE and some others always
+# issue an implicit commit, even if its argument is a
+# temporary table.
+# *Howewer* an implicit commit is a no-op if all engines
+# used since the start of transactiona are non-
+# transactional. Thus, for non-transactional engines,
+# these operations are not blocked by FTWRL.
+# This is class #3 -- compatible because do not take
+# MDL table locks and are non-transactional.
+# On the contrary, for transactional engines, there
+# is always a commit, regardless of whether a table
+# is temporary or not. Thus, for example, ALTER TABLE
+# for a transactional engine will wait for FTWRL,
+# even if the subject table is temporary.
+# Thus ALTER TABLE <temporary> is incompatible
+# with FTWRL. This is class #4 -- incompatible
+# becuase issue implicit COMMIT which is not a no-op.
+# Finally, there are administrative statements (such as
+# RESET SLAVE) that do not take any locks and do not
+# issue COMMIT.
+# This is class #5.
+# The goal of this coverage is to test statements
+# of all classes.
+# @todo: documents the effects of @@autocommit,
+# DML and temporary transactional tables.
+# Use MyISAM engine for the most of the tables
+# used in this test in order to be able to
+# check that DDL statements on temporary tables
+# are compatible with FTRWL.
+drop tables if exists t1_base, t2_base, t3_trans;
+drop tables if exists tm_base, tm_base_temp;
+drop database if exists mysqltest1;
+# We're going to test ALTER DATABASE UPGRADE
+drop database if exists `#mysql50#mysqltest-2`;
+drop procedure if exists p1;
+drop function if exists f1;
+drop view if exists v1;
+drop procedure if exists p2;
+drop function if exists f2_base;
+drop function if exists f2_temp;
+drop event if exists e1;
+drop event if exists e2;
+create table t1_base(i int) engine=myisam;
+create table t2_base(j int) engine=myisam;
+create table t3_trans(i int) engine=innodb;
+create temporary table t1_temp(i int) engine=myisam;
+create temporary table t2_temp(j int) engine=myisam;
+create temporary table t3_temp_trans(i int) engine=innodb;
+create database mysqltest1;
+create database `#mysql50#mysqltest-2`;
+create procedure p1() begin end;
+create function f1() returns int return 0;
+create view v1 as select 1 as i;
+create procedure p2(i int) begin end;
+create function f2_base() returns int
+begin
+insert into t1_base values (1);
+return 0;
+end|
+create function f2_temp() returns int
+begin
+insert into t1_temp values (1);
+return 0;
+end|
+create event e1 on schedule every 1 minute do begin end;
+#
+# Test compatibility of FLUSH TABLES WITH READ LOCK
+# with various statements.
+#
+# These tests don't cover some classes of statements:
+# - Replication-related - CHANGE MASTER TO, START/STOP SLAVE and etc
+# (all compatible with FTWRL).
+# - Plugin-related - INSTALL/UNINSTALL (incompatible with FTWRL,
+# require plugin support).
+#
+# 1) ALTER variants.
+#
+# 1.1) ALTER TABLE
+#
+# 1.1.a) For base table should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter table t1_base add column c1 int' under FTWRL.
+Success: 'alter table t1_base add column c1 int' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter table t1_base add column c1 int' is active in another connection.
+#
+# 1.1.b) For a temporary table should be compatible with FTWRL.
+#
+Success: Was able to run 'alter table t1_temp add column c1 int' under FTWRL.
+Success: Was able to run 'alter table t1_temp add column c1 int' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'alter table t1_temp add column c1 int' was active in another connection.
+#
+# 1.2) ALTER DATABASE should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter database mysqltest1 default character set utf8' under FTWRL.
+Success: 'alter database mysqltest1 default character set utf8' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter database mysqltest1 default character set utf8' is active in another connection.
+#
+# 1.3) ALTER DATABASE UPGRADE DATA DIRECTORY NAME should be
+# incompatible with FTWRL.
+#
+Success: Was not able to run 'alter database `#mysql50#mysqltest-2` upgrade data directory name' under FTWRL.
+Success: 'alter database `#mysql50#mysqltest-2` upgrade data directory name' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter database `#mysql50#mysqltest-2` upgrade data directory name' is active in another connection.
+#
+# 1.4) ALTER PROCEDURE should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter procedure p1 comment 'a'' under FTWRL.
+Success: 'alter procedure p1 comment 'a'' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter procedure p1 comment 'a'' is active in another connection.
+#
+# 1.5) ALTER FUNCTION should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter function f1 comment 'a'' under FTWRL.
+Success: 'alter function f1 comment 'a'' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter function f1 comment 'a'' is active in another connection.
+#
+# 1.6) ALTER VIEW should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter view v1 as select 2 as j' under FTWRL.
+Success: 'alter view v1 as select 2 as j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter view v1 as select 2 as j' is active in another connection.
+#
+# 1.7) ALTER EVENT should be incompatible with FTWRL.
+#
+Success: Was not able to run 'alter event e1 comment 'test'' under FTWRL.
+Success: 'alter event e1 comment 'test'' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter event e1 comment 'test'' is active in another connection.
+#
+# 1.x) The rest of ALTER statements (ALTER TABLESPACE,
+# ALTER LOGFILE GROUP and ALTER SERVER) are too
+# special to be tested here.
+#
+#
+# 2) ANALYZE TABLE statement is compatible with FTWRL.
+# See Bug#43336 ANALYZE and OPTIMIZE do not honour
+# --read-only for a discussion why.
+#
+Success: Was able to run 'analyze table t1_base' under FTWRL.
+Success: Was able to run 'analyze table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'analyze table t1_base' was active in another connection.
+#
+# 3) BEGIN, ROLLBACK and COMMIT statements.
+# BEGIN and ROLLBACK are compatible with FTWRL.
+# COMMIT is not.
+#
+# We need a special test for these statements as
+# FTWRL commits a transaction and because COMMIT
+# is handled in a special way.
+flush tables with read lock;
+begin;
+# ROLLBACK is allowed under FTWRL although there
+# no much sense in it. FTWRL commits any previous
+# changes and doesn't allows any DML after it.
+# So such a ROLLBACK is always a no-op.
+rollback;
+# Although COMMIT is incompatible with FTWRL in
+# other senses it is still allowed under FTWRL.
+# This fact relied upon by some versions of
+# innobackup tool.
+# Similarly to ROLLBACK it is a no-op in this situation.
+commit;
+unlock tables;
+# Check that BEGIN/ROLLBACK are not blocked and
+# COMMIT is blocked by active FTWRL in another
+# connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+begin;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Do some work so ROLLBACK is not a no-op.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+rollback;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+begin;
+# Do some work so COMMIT is not a no-op.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+# Send:
+commit;
+# Switching to connection 'con1'.
+# Wait until COMMIT is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap COMMIT.
+delete from t3_trans;
+#
+# Check that COMMIT blocks FTWRL in another connection.
+begin;
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+commit;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap COMMIT.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+delete from t3_trans;
+set debug_sync= "RESET";
+# We don't run similar test for BEGIN and ROLLBACK as
+# they release metadata locks in non-standard place.
+#
+# 4) BINLOG statement should be incompatible with FTWRL.
+#
+#
+# Provide format description BINLOG statement first.
+BINLOG '
+MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
+';
+# Now test compatibility for BINLOG statement which is
+# equivalent to INSERT INTO t1_base VALUES (1).
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was not able to run 'BINLOG '
+MfmqTBMBAAAALgAAAN0AAAAAACgAAAAAAAEABHRlc3QAB3QxX2Jhc2UAAQMAAQ==
+MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+AQAAAA==
+'' under FTWRL.
+Success: 'BINLOG '
+MfmqTBMBAAAALgAAAN0AAAAAACgAAAAAAAEABHRlc3QAB3QxX2Jhc2UAAQMAAQ==
+MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+AQAAAA==
+'' is blocked by FTWRL active in another connection.
+#
+# 5) CALL statement. This statement uses resources in two
+# ways: through expressions used as parameters and through
+# sub-statements. This test covers only usage through
+# parameters as sub-statements do locking individually.
+#
+# 5.a) In simple cases a parameter expression should be
+# compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'call p2((select count(*) from t1_base))' under FTWRL.
+Success: Was able to run 'call p2((select count(*) from t1_base))' with FTWRL active in another connection.
+#
+# 5.b) In case when an expression uses function which updates
+# base tables CALL should be incompatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was not able to run 'call p2(f2_base())' under FTWRL.
+Success: 'call p2(f2_base())' is blocked by FTWRL active in another connection.
+#
+# 5.c) If function used as argument updates temporary tables
+# CALL statement should be compatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'call p2(f2_temp())' under FTWRL.
+Success: Was able to run 'call p2(f2_temp())' with FTWRL active in another connection.
+#
+# 6) CHECK TABLE statement is compatible with FTWRL.
+#
+Success: Was able to run 'check table t1_base' under FTWRL.
+Success: Was able to run 'check table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'check table t1_base' was active in another connection.
+#
+# 7) CHECKSUM TABLE statement is compatible with FTWRL.
+#
+Success: Was able to run 'checksum table t1_base' under FTWRL.
+Success: Was able to run 'checksum table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'checksum table t1_base' was active in another connection.
+#
+# 8) CREATE variants.
+#
+# 8.1) CREATE TABLE statement.
+#
+# 8.1.a) CREATE TABLE is incompatible with FTWRL when
+# base table is created.
+Success: Was not able to run 'create table t3_base(i int)' under FTWRL.
+Success: 'create table t3_base(i int)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create table t3_base(i int)' is active in another connection.
+# 8.1.b) CREATE TABLE is compatible with FTWRL when
+# temporary table is created.
+Success: Was able to run 'create temporary table t3_temp(i int)' under FTWRL.
+Success: Was able to run 'create temporary table t3_temp(i int)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t3_temp(i int)' was active in another connection.
+# 8.1.c) CREATE TABLE LIKE is incompatible with FTWRL when
+# base table is created.
+Success: Was not able to run 'create table t3_base like t1_temp' under FTWRL.
+Success: 'create table t3_base like t1_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create table t3_base like t1_temp' is active in another connection.
+# 8.1.d) CREATE TABLE LIKE is compatible with FTWRL when
+# temporary table is created.
+Success: Was able to run 'create temporary table t3_temp like t1_base' under FTWRL.
+Success: Was able to run 'create temporary table t3_temp like t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t3_temp like t1_base' was active in another connection.
+# 8.1.e) CREATE TABLE SELECT is incompatible with FTWRL when
+# base table is created.
+Success: Was not able to run 'create table t3_base select 1 as i' under FTWRL.
+Success: 'create table t3_base select 1 as i' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create table t3_base select 1 as i' is active in another connection.
+# 8.1.f) CREATE TABLE SELECT is compatible with FTWRL when
+# temporary table is created.
+Success: Was able to run 'create temporary table t3_temp select 1 as i' under FTWRL.
+Success: Was able to run 'create temporary table t3_temp select 1 as i' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t3_temp select 1 as i' was active in another connection.
+# 8.2) CREATE INDEX statement.
+#
+# 8.2.a) CREATE INDEX is incompatible with FTWRL when
+# applied to base table.
+Success: Was not able to run 'create index i on t1_base (i)' under FTWRL.
+Success: 'create index i on t1_base (i)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create index i on t1_base (i)' is active in another connection.
+# 8.2.b) CREATE INDEX is compatible with FTWRL when
+# applied to temporary table.
+Success: Was able to run 'create index i on t1_temp (i)' under FTWRL.
+Success: Was able to run 'create index i on t1_temp (i)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create index i on t1_temp (i)' was active in another connection.
+#
+# 8.3) CREATE DATABASE is incompatible with FTWRL.
+#
+Success: Was not able to run 'create database mysqltest2' under FTWRL.
+Success: 'create database mysqltest2' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create database mysqltest2' is active in another connection.
+#
+# 8.4) CREATE VIEW is incompatible with FTWRL.
+#
+Success: Was not able to run 'create view v2 as select 1 as j' under FTWRL.
+Success: 'create view v2 as select 1 as j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create view v2 as select 1 as j' is active in another connection.
+#
+# 8.5) CREATE TRIGGER is incompatible with FTWRL.
+#
+Success: Was not able to run 'create trigger t1_bi before insert on t1_base for each row begin end' under FTWRL.
+Success: 'create trigger t1_bi before insert on t1_base for each row begin end' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create trigger t1_bi before insert on t1_base for each row begin end' is active in another connection.
+#
+# 8.6) CREATE FUNCTION is incompatible with FTWRL.
+#
+Success: Was not able to run 'create function f2() returns int return 0' under FTWRL.
+Success: 'create function f2() returns int return 0' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create function f2() returns int return 0' is active in another connection.
+#
+# 8.7) CREATE PROCEDURE is incompatible with FTWRL.
+#
+Success: Was not able to run 'create procedure p3() begin end' under FTWRL.
+Success: 'create procedure p3() begin end' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create procedure p3() begin end' is active in another connection.
+#
+# 8.8) CREATE EVENT should be incompatible with FTWRL.
+#
+Success: Was not able to run 'create event e2 on schedule every 1 minute do begin end' under FTWRL.
+Success: 'create event e2 on schedule every 1 minute do begin end' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create event e2 on schedule every 1 minute do begin end' is active in another connection.
+#
+# 8.9) CREATE USER should be incompatible with FTWRL.
+#
+Success: Was not able to run 'create user mysqltest_u1' under FTWRL.
+Success: 'create user mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'create user mysqltest_u1' is active in another connection.
+#
+# 8.x) The rest of CREATE variants (CREATE LOGFILE GROUP,
+# CREATE TABLESPACE and CREATE SERVER) are too special
+# to test here.
+#
+#
+# 9) PREPARE, EXECUTE and DEALLOCATE PREPARE statements.
+#
+# 9.1) PREPARE statement is compatible with FTWRL as it
+# doesn't change any data.
+#
+# 9.1.a) Prepare of simple INSERT statement.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'prepare stmt1 from 'insert into t1_base values (1)'' under FTWRL.
+Success: Was able to run 'prepare stmt1 from 'insert into t1_base values (1)'' with FTWRL active in another connection.
+#
+# 9.1.b) Prepare of multi-UPDATE. At some point such statements
+# tried to acquire thr_lock.c locks during prepare phase.
+# This no longer happens and thus it is compatible with
+# FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'prepare stmt1 from 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j'' under FTWRL.
+Success: Was able to run 'prepare stmt1 from 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j'' with FTWRL active in another connection.
+#
+# 9.1.c) Prepare of multi-DELETE. Again PREPARE of such
+# statement should be compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'prepare stmt1 from 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j'' under FTWRL.
+Success: Was able to run 'prepare stmt1 from 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j'' with FTWRL active in another connection.
+#
+# 9.2) Compatibility of EXECUTE statement depends on statement
+# to be executed.
+#
+# 9.2.a) EXECUTE for statement which is itself compatible with
+# FTWRL should be compatible.
+prepare stmt1 from 'select * from t1_base';
+Success: Was able to run 'execute stmt1' under FTWRL.
+Success: Was able to run 'execute stmt1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'execute stmt1' was active in another connection.
+deallocate prepare stmt1;
+call mtr.add_suppression("Slave SQL.*Can.t execute the query because you have a conflicting read lock., Error_code: 1223");
+#
+# 9.2.b) EXECUTE for statement which is incompatible with FTWRL
+# should be also incompatible.
+#
+# Check that EXECUTE is not allowed under FTWRL.
+prepare stmt1 from 'insert into t1_base values (1)';
+flush tables with read lock;
+execute stmt1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+# Check that active FTWRL in another connection
+# blocks EXECUTE which changes data.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+execute stmt1 ;
+# Switching to connection 'con1'.
+# Check that EXECUTE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap EXECUTE.
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+execute stmt1; ;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap EXECUTE.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+set debug_sync= "RESET";
+delete from t1_base;
+deallocate prepare stmt1;
+#
+# 9.3) DEALLOCATE PREPARE is compatible with FTWRL.
+#
+prepare stmt1 from 'insert into t1_base values (1)';
+Success: Was able to run 'deallocate prepare stmt1' under FTWRL.
+Success: Was able to run 'deallocate prepare stmt1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'deallocate prepare stmt1' was active in another connection.
+deallocate prepare stmt1;
+#
+# 10) DELETE variations.
+#
+# 10.1) Simple DELETE.
+#
+# 10.1.a) Simple DELETE on base table is incompatible with FTWRL.
+Success: Was not able to run 'delete from t1_base' under FTWRL.
+Success: 'delete from t1_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'delete from t1_base' is active in another connection.
+#
+# 10.1.b) Simple DELETE on temporary table is compatible with FTWRL.
+Success: Was able to run 'delete from t1_temp' under FTWRL.
+Success: Was able to run 'delete from t1_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete from t1_temp' was active in another connection.
+#
+# 10.2) Multi DELETE.
+#
+# 10.2.a) Multi DELETE on base tables is incompatible with FTWRL.
+Success: Was not able to run 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j' under FTWRL.
+Success: 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j' is active in another connection.
+#
+# 10.2.b) Multi DELETE on temporary tables is compatible with FTWRL.
+Success: Was able to run 'delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j' was active in another connection.
+#
+# 11) DESCRIBE should be compatible with FTWRL.
+#
+Success: Was able to run 'describe t1_base' under FTWRL.
+Success: Was able to run 'describe t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'describe t1_base' was active in another connection.
+#
+# 12) Compatibility of DO statement with FTWRL depends on its
+# expression.
+#
+# 12.a) DO with expression which does not change base table
+# should be compatible with FTWRL.
+Success: Was able to run 'do (select count(*) from t1_base)' under FTWRL.
+Success: Was able to run 'do (select count(*) from t1_base)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'do (select count(*) from t1_base)' was active in another connection.
+#
+# 12.b) DO which calls SF updating base table should be
+# incompatible with FTWRL.
+Success: Was not able to run 'do f2_base()' under FTWRL.
+Success: 'do f2_base()' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'do f2_base()' is active in another connection.
+#
+# 12.c) DO which calls SF updating temporary table should be
+# compatible with FTWRL.
+Success: Was able to run 'do f2_temp()' under FTWRL.
+Success: Was able to run 'do f2_temp()' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'do f2_temp()' was active in another connection.
+#
+# 13) DROP variants.
+#
+# 13.1) DROP TABLES.
+#
+# 13.1.a) DROP TABLES which affects base tables is incompatible
+# with FTWRL.
+Success: Was not able to run 'drop table t2_base' under FTWRL.
+Success: 'drop table t2_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop table t2_base' is active in another connection.
+# 13.1.b) DROP TABLES which affects only temporary tables
+# in theory can be compatible with FTWRL.
+# In practice it is not yet.
+Success: Was not able to run 'drop table t2_temp' under FTWRL.
+Success: 'drop table t2_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop table t2_temp' is active in another connection.
+#
+# 13.1.c) DROP TEMPORARY TABLES should be compatible with FTWRL.
+Success: Was able to run 'drop temporary table t2_temp' under FTWRL.
+Success: Was able to run 'drop temporary table t2_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop temporary table t2_temp' was active in another connection.
+#
+# 13.2) DROP INDEX.
+#
+# 13.2.a) DROP INDEX on a base table is incompatible with FTWRL.
+create index i on t1_base (i);
+Success: Was not able to run 'drop index i on t1_base' under FTWRL.
+Success: 'drop index i on t1_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop index i on t1_base' is active in another connection.
+drop index i on t1_base;
+#
+# 13.2.b) DROP INDEX on a temporary table is compatible with FTWRL.
+create index i on t1_temp (i);
+Success: Was able to run 'drop index i on t1_temp' under FTWRL.
+Success: Was able to run 'drop index i on t1_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop index i on t1_temp' was active in another connection.
+drop index i on t1_temp;
+#
+# 13.3) DROP DATABASE is incompatible with FTWRL
+#
+Success: Was not able to run 'drop database mysqltest1' under FTWRL.
+Success: 'drop database mysqltest1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop database mysqltest1' is active in another connection.
+#
+# 13.4) DROP FUNCTION is incompatible with FTWRL.
+#
+Success: Was not able to run 'drop function f1' under FTWRL.
+Success: 'drop function f1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop function f1' is active in another connection.
+#
+# 13.5) DROP PROCEDURE is incompatible with FTWRL.
+#
+Success: Was not able to run 'drop procedure p1' under FTWRL.
+Success: 'drop procedure p1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop procedure p1' is active in another connection.
+#
+# 13.6) DROP USER should be incompatible with FTWRL.
+#
+create user mysqltest_u1;
+Success: Was not able to run 'drop user mysqltest_u1' under FTWRL.
+Success: 'drop user mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop user mysqltest_u1' is active in another connection.
+drop user mysqltest_u1;
+#
+# 13.7) DROP VIEW should be incompatible with FTWRL.
+#
+Success: Was not able to run 'drop view v1' under FTWRL.
+Success: 'drop view v1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop view v1' is active in another connection.
+#
+# 13.8) DROP EVENT should be incompatible with FTWRL.
+#
+Success: Was not able to run 'drop event e1' under FTWRL.
+Success: 'drop event e1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop event e1' is active in another connection.
+#
+# 13.9) DROP TRIGGER is incompatible with FTWRL.
+#
+create trigger t1_bi before insert on t1_base for each row begin end;
+Success: Was not able to run 'drop trigger t1_bi' under FTWRL.
+Success: 'drop trigger t1_bi' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'drop trigger t1_bi' is active in another connection.
+drop trigger t1_bi;
+#
+# 13.x) The rest of DROP variants (DROP TABLESPACE, DROP LOGFILE
+# GROUP and DROP SERVER) are too special to test here.
+#
+#
+# 14) FLUSH variants.
+#
+# Test compatibility of _some_ important FLUSH variants with FTWRL.
+#
+# 14.1) FLUSH TABLES WITH READ LOCK is compatible with itself.
+#
+# Check that FTWRL statements can be run while FTWRL
+# is active in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# The second FTWRL in a row is allowed at the moment.
+# It does not make much sense as it does only flush.
+flush tables with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+flush tables with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
+# active FTWRL. But since the latter keeps tables open
+# FTWRL is blocked by FLUSH TABLES <list> WITH READ LOCK.
+flush tables with read lock;
+# FT <list> WRL is allowed under FTWRL at the moment.
+# It does not make much sense though.
+flush tables t1_base, t2_base with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+flush tables t1_base, t2_base with read lock;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+flush tables t1_base, t2_base with read lock;
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+# Switching to connection 'default'.
+unlock tables;
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 14.3) FLUSH TABLES is compatible with FTWRL.
+Success: Was able to run 'flush tables' under FTWRL.
+Success: Was able to run 'flush tables' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'flush tables' was active in another connection.
+#
+# 14.4) FLUSH TABLES <list> is compatible with FTWRL.
+Success: Was able to run 'flush table t1_base, t2_base' under FTWRL.
+Success: Was able to run 'flush table t1_base, t2_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'flush table t1_base, t2_base' was active in another connection.
+#
+# 14.5) FLUSH PRIVILEGES is compatible with FTWRL.
+Success: Was able to run 'flush privileges' under FTWRL.
+Success: Was able to run 'flush privileges' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'flush privileges' was active in another connection.
+#
+# 15) GRANT statement should be incompatible with FTWRL.
+#
+Success: Was not able to run 'grant all privileges on t1_base to mysqltest_u1' under FTWRL.
+Success: 'grant all privileges on t1_base to mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'grant all privileges on t1_base to mysqltest_u1' is active in another connection.
+drop user mysqltest_u1;
+#
+# 16) All HANDLER variants are half-compatible with FTWRL.
+# I.e. they are not blocked by active FTWRL. But since open
+# HANDLER means open table instance FTWRL is blocked while
+# HANDLER is not closed.
+#
+# Check that HANDLER statements succeed under FTWRL.
+flush tables with read lock;
+handler t1_base open;
+handler t1_base read first;
+i
+handler t1_base close;
+unlock tables;
+# Check that HANDLER statements can be run while FTWRL
+# is active in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+handler t1_base open;
+handler t1_base read first;
+i
+handler t1_base close;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 17) HELP statement is compatible with FTWRL.
+#
+Success: Was able to run 'help no_such_topic' under FTWRL.
+Success: Was able to run 'help no_such_topic' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'help no_such_topic' was active in another connection.
+#
+# 18) INSERT statement.
+#
+# 18.a) Ordinary INSERT into base table is incompatible with FTWRL.
+Success: Was not able to run 'insert into t1_base values (1)' under FTWRL.
+Success: 'insert into t1_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into t1_base values (1)' is active in another connection.
+#
+# 18.b) Ordinary INSERT into temp table is compatible with FTWRL.
+Success: Was able to run 'insert into t1_temp values (1)' under FTWRL.
+Success: Was able to run 'insert into t1_temp values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t1_temp values (1)' was active in another connection.
+#
+# 18.c) INSERT DELAYED is incompatible with FTWRL.
+Success: Was not able to run 'insert delayed into t1_base values (1)' under FTWRL.
+Success: 'insert delayed into t1_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert delayed into t1_base values (1)' is active in another connection.
+delete from t1_base;
+#
+# 18.d) INSERT SELECT into base table is incompatible with FTWRL.
+Success: Was not able to run 'insert into t1_base select * from t1_temp' under FTWRL.
+Success: 'insert into t1_base select * from t1_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into t1_base select * from t1_temp' is active in another connection.
+#
+# 18.e) INSERT SELECT into temp table is compatible with FTWRL.
+Success: Was able to run 'insert into t1_temp select * from t1_base' under FTWRL.
+Success: Was able to run 'insert into t1_temp select * from t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t1_temp select * from t1_base' was active in another connection.
+#
+# 19) KILL statement is compatible with FTWRL.
+#
+# Check that KILL can be run under FTWRL.
+flush tables with read lock;
+set @id:= connection_id();
+kill query @id;
+ERROR 70100: Query execution was interrupted
+unlock tables;
+# Check that KILL statements can be run while FTWRL
+# is active in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+kill query @id;
+ERROR 70100: Query execution was interrupted
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Finally check that KILL doesn't block FTWRL
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+kill query @id;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap KILL.
+ERROR 70100: Query execution was interrupted
+set debug_sync='RESET';
+#
+# 20) LOAD DATA statement.
+#
+# 20.a) LOAD DATA into base table is incompatible with FTWRL.
+Success: Was not able to run 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i)' under FTWRL.
+Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i)' is active in another connection.
+#
+# 20.b) LOAD DATA into temporary table is compatible with FTWRL.
+Success: Was able to run 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i)' under FTWRL.
+Success: Was able to run 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i)' was active in another connection.
+#
+# 21) LOCK/UNLOCK TABLES statements.
+#
+# LOCK TABLES statement always (almost) blocks FTWRL as it
+# keeps tables open until UNLOCK TABLES.
+# Active FTWRL on the other hand blocks only those
+# LOCK TABLES which allow updating of base tables.
+#
+# 21.a) LOCK TABLES READ is allowed under FTWRL and
+# is not blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_base read;
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+lock tables t1_base read;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 21.b) LOCK TABLES WRITE on a base table is disallowed
+# under FTWRL and should be blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_base write;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+lock tables t1_base write ;
+# Switching to connection 'con1'.
+# Check that LOCK TABLES WRITE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap LOCK TABLES WRITE
+unlock tables;
+#
+# 21.c) LOCK TABLES WRITE on temporary table doesn't
+# make much sense but is allowed under FTWRL
+# and should not be blocked by active FTWRL.
+flush tables with read lock;
+lock tables t1_temp write;
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+lock tables t1_temp write;
+unlock tables;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+#
+# 22) OPTIMIZE TABLE statement.
+#
+# 22.a) OPTIMIZE TABLE of base table is incompatible with FTWRL.
+flush tables with read lock;
+# OPTIMIZE statement returns errors as part of result-set.
+optimize table t1_base;
+Table Op Msg_type Msg_text
+test.t1_base optimize Error Can't execute the query because you have a conflicting read lock
+test.t1_base optimize error Corrupt
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+optimize table t1_base;
+# Switching to connection 'con1'.
+# Check that OPTIMIZE TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap OPTIMIZE TABLE
+Table Op Msg_type Msg_text
+test.t1_base optimize status OK
+# We don't check that active OPTIMIZE TABLE blocks
+# FTWRL as this one of statements releasing metadata
+# locks in non-standard place.
+#
+# 22.b) OPTIMIZE TABLE of temporary table is compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'optimize table t1_temp' under FTWRL.
+Success: Was able to run 'optimize table t1_temp' with FTWRL active in another connection.
+#
+# 23) CACHE statement is compatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'cache index t1_base in default' under FTWRL.
+Success: Was able to run 'cache index t1_base in default' with FTWRL active in another connection.
+#
+# 24) LOAD INDEX statement is compatible with FTWRL.
+#
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'load index into cache t1_base' under FTWRL.
+Success: Was able to run 'load index into cache t1_base' with FTWRL active in another connection.
+#
+# 25) SAVEPOINT/RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT are
+# compatible with FTWRL.
+#
+# Since manipulations on savepoint have to be done
+# inside transaction and FTWRL commits transaction we
+# need a special test for these statements.
+flush tables with read lock;
+begin;
+savepoint sv1;
+rollback to savepoint sv1;
+release savepoint sv1;
+unlock tables;
+commit;
+# Check that these statements are not blocked by
+# active FTWRL in another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+begin;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Do some changes to avoid SAVEPOINT and friends
+# being almost no-ops.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+savepoint sv1;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+insert into t3_trans values (2);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+rollback to savepoint sv1;
+release savepoint sv1;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+rollback;
+# Check that these statements don't block FTWRL in
+# another connection.
+begin;
+# Do some changes to avoid SAVEPOINT and friends
+# being almost no-ops.
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+savepoint sv1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap SAVEPOINT
+insert into t3_trans values (2);
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+rollback to savepoint sv1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap ROLLBACK TO SAVEPOINT
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+release savepoint sv1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+unlock tables;
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap RELEASE SAVEPOINT
+rollback;
+set debug_sync= "RESET";
+#
+# 26) RENAME variants.
+#
+# 26.1) RENAME TABLES is incompatible with FTWRL.
+Success: Was not able to run 'rename table t1_base to t3_base' under FTWRL.
+Success: 'rename table t1_base to t3_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'rename table t1_base to t3_base' is active in another connection.
+#
+# 26.2) RENAME USER is incompatible with FTWRL.
+create user mysqltest_u1;
+Success: Was not able to run 'rename user mysqltest_u1 to mysqltest_u2' under FTWRL.
+Success: 'rename user mysqltest_u1 to mysqltest_u2' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'rename user mysqltest_u1 to mysqltest_u2' is active in another connection.
+drop user mysqltest_u1;
+#
+# 27) REPAIR TABLE statement.
+#
+# 27.a) REPAIR TABLE of base table is incompatible with FTWRL.
+flush tables with read lock;
+# REPAIR statement returns errors as part of result-set.
+repair table t1_base;
+Table Op Msg_type Msg_text
+test.t1_base repair Error Can't execute the query because you have a conflicting read lock
+test.t1_base repair error Corrupt
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+repair table t1_base;
+# Switching to connection 'con1'.
+# Check that REPAIR TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap REPAIR TABLE
+Table Op Msg_type Msg_text
+test.t1_base repair status OK
+# We don't check that active REPAIR TABLE blocks
+# FTWRL as this one of statements releasing metadata
+# locks in non-standard place.
+#
+# 27.b) REPAIR TABLE of temporary table is compatible with FTWRL.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'repair table t1_temp' under FTWRL.
+Success: Was able to run 'repair table t1_temp' with FTWRL active in another connection.
+#
+# 28) REPLACE statement.
+#
+# 28.a) Ordinary REPLACE into base table is incompatible with FTWRL.
+Success: Was not able to run 'replace into t1_base values (1)' under FTWRL.
+Success: 'replace into t1_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'replace into t1_base values (1)' is active in another connection.
+#
+# 28.b) Ordinary REPLACE into temp table is compatible with FTWRL.
+Success: Was able to run 'replace into t1_temp values (1)' under FTWRL.
+Success: Was able to run 'replace into t1_temp values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'replace into t1_temp values (1)' was active in another connection.
+#
+# 28.c) REPLACE SELECT into base table is incompatible with FTWRL.
+Success: Was not able to run 'replace into t1_base select * from t1_temp' under FTWRL.
+Success: 'replace into t1_base select * from t1_temp' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'replace into t1_base select * from t1_temp' is active in another connection.
+#
+# 28.d) REPLACE SELECT into temp table is compatible with FTWRL.
+Success: Was able to run 'replace into t1_temp select * from t1_base' under FTWRL.
+Success: Was able to run 'replace into t1_temp select * from t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'replace into t1_temp select * from t1_base' was active in another connection.
+#
+# 29) REVOKE variants.
+#
+# 29.1) REVOKE privileges is incompatible with FTWRL.
+grant all privileges on t1_base to mysqltest_u1;
+Success: Was not able to run 'revoke all privileges on t1_base from mysqltest_u1' under FTWRL.
+Success: 'revoke all privileges on t1_base from mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'revoke all privileges on t1_base from mysqltest_u1' is active in another connection.
+#
+# 29.2) REVOKE ALL PRIVILEGES, GRANT OPTION is incompatible with FTWRL.
+Success: Was not able to run 'revoke all privileges, grant option from mysqltest_u1' under FTWRL.
+Success: 'revoke all privileges, grant option from mysqltest_u1' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'revoke all privileges, grant option from mysqltest_u1' is active in another connection.
+drop user mysqltest_u1;
+#
+# 30) Compatibility of SELECT statement with FTWRL depends on
+# locking mode used and on functions being invoked by it.
+#
+# 30.a) Simple SELECT which does not change tables should be
+# compatible with FTWRL.
+Success: Was able to run 'select count(*) from t1_base' under FTWRL.
+Success: Was able to run 'select count(*) from t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'select count(*) from t1_base' was active in another connection.
+# 30.b) SELECT ... FOR UPDATE is incompatible with FTWRL.
+Success: Was not able to run 'select count(*) from t1_base for update' under FTWRL.
+Success: 'select count(*) from t1_base for update' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'select count(*) from t1_base for update' is active in another connection.
+# 30.c) SELECT ... LOCK IN SHARE MODE is compatible with FTWRL.
+Success: Was able to run 'select count(*) from t1_base lock in share mode' under FTWRL.
+Success: Was able to run 'select count(*) from t1_base lock in share mode' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'select count(*) from t1_base lock in share mode' was active in another connection.
+#
+# 30.d) SELECT which calls SF updating base table should be
+# incompatible with FTWRL.
+Success: Was not able to run 'select f2_base()' under FTWRL.
+Success: 'select f2_base()' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'select f2_base()' is active in another connection.
+#
+# 30.e) SELECT which calls SF updating temporary table should be
+# compatible with FTWRL.
+Success: Was able to run 'select f2_temp()' under FTWRL.
+Success: Was able to run 'select f2_temp()' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'select f2_temp()' was active in another connection.
+#
+# 31) Compatibility of SET statement with FTWRL depends on its
+# expression and on whether it is a special SET statement.
+#
+# 31.a) Ordinary SET with expression which does not
+# changes base table should be compatible with FTWRL.
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was able to run 'set @a:= (select count(*) from t1_base)' under FTWRL.
+Success: Was able to run 'set @a:= (select count(*) from t1_base)' with FTWRL active in another connection.
+#
+# 31.b) Ordinary SET which calls SF updating base table should
+# be incompatible with FTWRL.
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was not able to run 'set @a:= f2_base()' under FTWRL.
+Success: 'set @a:= f2_base()' is blocked by FTWRL active in another connection.
+#
+# 31.c) Ordinary SET which calls SF updating temporary table
+# should be compatible with FTWRL.
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was able to run 'set @a:= f2_temp()' under FTWRL.
+Success: Was able to run 'set @a:= f2_temp()' with FTWRL active in another connection.
+#
+# 31.d) Special SET variants have different compatibility with FTWRL.
+#
+# 31.d.I) SET PASSWORD is incompatible with FTWRL as it changes data.
+create user mysqltest_u1;
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was not able to run 'set password for 'mysqltest_u1' = password('')' under FTWRL.
+Success: 'set password for 'mysqltest_u1' = password('')' is blocked by FTWRL active in another connection.
+drop user mysqltest_u1;
+#
+# 31.d.II) SET READ_ONLY is compatible with FTWRL (but has no
+# effect when executed under it).
+# Skip last part of compatibility testing as our helper debug
+# sync-point doesn't work for SET statements.
+Success: Was able to run 'set global read_only= 1' under FTWRL.
+Success: Was able to run 'set global read_only= 1' with FTWRL active in another connection.
+#
+# 31.d.III) Situation with SET AUTOCOMMIT is complex.
+# Turning auto-commit off is always compatible with FTWRL.
+# Turning auto-commit on causes implicit commit and so
+# is incompatible with FTWRL if there are changes to be
+# committed.
+flush tables with read lock;
+set autocommit= 0;
+# Turning auto-commit on causes implicit commit so can
+# be incompatible with FTWRL if there is something to
+# commit. But since even in this case we allow commits
+# under active FTWRL such statement should always succeed.
+insert into t3_temp_trans values (1);
+set autocommit= 1;
+unlock tables;
+delete from t3_temp_trans;
+# Check that SET AUTOCOMMIT=0 is not blocked and
+# SET AUTOCOMMIT=1 is blocked by active FTWRL in
+# another connection.
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+set autocommit= 0;
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+# Do some work so implicit commit in SET AUTOCOMMIT=1
+# is not a no-op.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+# Send:
+set autocommit= 1;
+# Switching to connection 'con1'.
+# Wait until SET AUTOCOMMIT=1 is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap SET AUTOCOMMIT=1.
+delete from t3_trans;
+#
+# Check that SET AUTOCOMMIT=1 blocks FTWRL in another connection.
+set autocommit= 0;
+insert into t3_trans values (1);
+set debug_sync='RESET';
+set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+set autocommit= 1;
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap SET AUTOCOMMIT=1.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+delete from t3_trans;
+set debug_sync= "RESET";
+#
+# 32) SHOW statements are compatible with FTWRL.
+# Let us test _some_ of them.
+#
+# 32.1) SHOW TABLES.
+Success: Was able to run 'show tables from test' under FTWRL.
+Success: Was able to run 'show tables from test' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show tables from test' was active in another connection.
+#
+# 32.1) SHOW TABLES.
+Success: Was able to run 'show tables from test' under FTWRL.
+Success: Was able to run 'show tables from test' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show tables from test' was active in another connection.
+#
+# 32.2) SHOW EVENTS.
+Success: Was able to run 'show events from test' under FTWRL.
+Success: Was able to run 'show events from test' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show events from test' was active in another connection.
+#
+# 32.3) SHOW GRANTS.
+create user mysqltest_u1;
+Success: Was able to run 'show grants for mysqltest_u1' under FTWRL.
+Success: Was able to run 'show grants for mysqltest_u1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show grants for mysqltest_u1' was active in another connection.
+drop user mysqltest_u1;
+#
+# 32.4) SHOW CREATE TABLE.
+Success: Was able to run 'show create table t1_base' under FTWRL.
+Success: Was able to run 'show create table t1_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show create table t1_base' was active in another connection.
+#
+# 32.5) SHOW CREATE FUNCTION.
+Success: Was able to run 'show create function f1' under FTWRL.
+Success: Was able to run 'show create function f1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'show create function f1' was active in another connection.
+#
+# 33) SIGNAL statement is compatible with FTWRL.
+#
+# Note that we don't cover RESIGNAL as it requires
+# active handler context.
+Success: Was able to run 'signal sqlstate '01000'' under FTWRL.
+Success: Was able to run 'signal sqlstate '01000'' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'signal sqlstate '01000'' was active in another connection.
+#
+# 34) TRUNCATE TABLE statement.
+#
+# 34.a) TRUNCATE of base table is incompatible with FTWRL.
+Success: Was not able to run 'truncate table t1_base' under FTWRL.
+Success: 'truncate table t1_base' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'truncate table t1_base' is active in another connection.
+#
+# 34.b) TRUNCATE of temporary table is compatible with FTWRL.
+Success: Was able to run 'truncate table t1_temp' under FTWRL.
+Success: Was able to run 'truncate table t1_temp' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'truncate table t1_temp' was active in another connection.
+#
+# 35) UPDATE variants.
+#
+# 35.1) Simple UPDATE.
+#
+# 35.1.a) Simple UPDATE on base table is incompatible with FTWRL.
+Success: Was not able to run 'update t1_base set i= 1 where i = 0' under FTWRL.
+Success: 'update t1_base set i= 1 where i = 0' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'update t1_base set i= 1 where i = 0' is active in another connection.
+#
+# 35.1.b) Simple UPDATE on temporary table is compatible with FTWRL.
+Success: Was able to run 'update t1_temp set i= 1 where i = 0' under FTWRL.
+Success: Was able to run 'update t1_temp set i= 1 where i = 0' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t1_temp set i= 1 where i = 0' was active in another connection.
+#
+# 35.2) Multi UPDATE.
+#
+# 35.2.a) Multi UPDATE on base tables is incompatible with FTWRL.
+Success: Was not able to run 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j' under FTWRL.
+Success: 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j' is active in another connection.
+#
+# 35.2.b) Multi UPDATE on temporary tables is compatible with FTWRL.
+Success: Was able to run 'update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j' was active in another connection.
+#
+# 36) USE statement is compatible with FTWRL.
+#
+Success: Was able to run 'use mysqltest1' under FTWRL.
+Success: Was able to run 'use mysqltest1' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'use mysqltest1' was active in another connection.
+#
+# 37) XA statements.
+#
+# XA statements are similar to BEGIN/COMMIT/ROLLBACK.
+#
+# XA BEGIN, END, PREPARE, ROLLBACK and RECOVER are compatible
+# with FTWRL. XA COMMIT is not.
+flush tables with read lock;
+# Although all below statements are allowed under FTWRL they
+# are almost no-ops as FTWRL does commit and does not allows
+# any non-temporary DML under it.
+xa start 'test1';
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+xa start 'test1';
+xa end 'test1';
+xa prepare 'test1';
+xa commit 'test1';
+xa recover;
+unlock tables;
+# Check that XA non-COMMIT statements are not and COMMIT is
+# blocked by active FTWRL in another connection
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+xa start 'test1';
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+xa end 'test1';
+xa prepare 'test1';
+xa rollback 'test1';
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+xa start 'test1';
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+xa end 'test1';
+xa prepare 'test1';
+# Send:
+xa commit 'test1';;
+# Switching to connection 'con1'.
+# Wait until XA COMMIT is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap XA COMMIT.
+delete from t3_trans;
+#
+# Check that XA COMMIT blocks FTWRL in another connection.
+xa start 'test1';
+insert into t3_trans values (1);
+xa end 'test1';
+xa prepare 'test1';
+set debug_sync='RESET';
+set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
+xa commit 'test1';
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap XA COMMIT.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'default'.
+delete from t3_trans;
+set debug_sync= "RESET";
+#
+# 38) Test effect of auto-commit mode for DML on transactional
+# temporary tables.
+#
+# 38.1) When auto-commit is on each such a statement ends with commit
+# of changes to temporary tables. But since transactions doing
+# such changes are considered read only [sic!/QQ] this commit
+# is compatible with FTWRL.
+#
+# Let us demostrate this fact for some common DML statements.
+Success: Was able to run 'delete from t3_temp_trans' under FTWRL.
+Success: Was able to run 'delete from t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete from t3_temp_trans' was active in another connection.
+Success: Was able to run 'insert into t3_temp_trans values (1)' under FTWRL.
+Success: Was able to run 'insert into t3_temp_trans values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t3_temp_trans values (1)' was active in another connection.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' was active in another connection.
+#
+# 38.2) When auto-commit is off DML on transaction temporary tables
+# is compatible with FTWRL.
+#
+set autocommit= 0;
+Success: Was able to run 'delete from t3_temp_trans' under FTWRL.
+Success: Was able to run 'delete from t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'delete from t3_temp_trans' was active in another connection.
+Success: Was able to run 'insert into t3_temp_trans values (1)' under FTWRL.
+Success: Was able to run 'insert into t3_temp_trans values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into t3_temp_trans values (1)' was active in another connection.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' under FTWRL.
+Success: Was able to run 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j' was active in another connection.
+set autocommit= 1;
+#
+# 39) Test effect of DDL on transactional tables.
+#
+# 39.1) Due to implicit commit at the end of statement some of DDL
+# statements which are compatible with FTWRL in non-transactional
+# case are not compatible in case of transactional tables.
+#
+# 39.1.a) ANALYZE TABLE for transactional table is incompatible with
+# FTWRL.
+flush tables with read lock;
+# Implicit commits are allowed under FTWRL.
+analyze table t3_trans;
+Table Op Msg_type Msg_text
+test.t3_trans analyze status OK
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+analyze table t3_trans;
+# Switching to connection 'con1'.
+# Check that ANALYZE TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap ANALYZE TABLE
+Table Op Msg_type Msg_text
+test.t3_trans analyze status OK
+#
+# 39.1.b) CHECK TABLE for transactional table is compatible with FTWRL.
+# Although it does implicit commit at the end of statement it
+# is considered to be read-only operation.
+# Skip last part of compatibility testing as this statement
+# releases metadata locks in non-standard place.
+Success: Was able to run 'check table t3_trans' under FTWRL.
+Success: Was able to run 'check table t3_trans' with FTWRL active in another connection.
+#
+# 39.2) Situation with DDL on temporary transactional tables is
+# complex.
+#
+# 39.2.a) Some statements compatible with FTWRL since they don't
+# do implicit commit.
+#
+# For example, CREATE TEMPORARY TABLE:
+Success: Was able to run 'create temporary table t4_temp_trans(i int) engine=innodb' under FTWRL.
+Success: Was able to run 'create temporary table t4_temp_trans(i int) engine=innodb' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'create temporary table t4_temp_trans(i int) engine=innodb' was active in another connection.
+#
+# Or DROP TEMPORARY TABLE:
+Success: Was able to run 'drop temporary tables t3_temp_trans' under FTWRL.
+Success: Was able to run 'drop temporary tables t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop temporary tables t3_temp_trans' was active in another connection.
+#
+# 39.2.b) Some statements do implicit commit but are considered
+# read-only and so are compatible with FTWRL.
+#
+# For example, REPAIR TABLE:
+Success: Was able to run 'repair table t3_temp_trans' under FTWRL.
+Success: Was able to run 'repair table t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'repair table t3_temp_trans' was active in another connection.
+#
+# And ANALYZE TABLE:
+Success: Was able to run 'analyze table t3_temp_trans' under FTWRL.
+Success: Was able to run 'analyze table t3_temp_trans' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'analyze table t3_temp_trans' was active in another connection.
+#
+# 39.2.c) Some statements do implicit commit and not
+# considered read-only. As result they are
+# not compatible with FTWRL.
+#
+flush tables with read lock;
+# Implicit commits are allowed under FTWRL.
+alter table t3_temp_trans add column c1 int;
+unlock tables;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+alter table t3_temp_trans drop column c1;
+# Switching to connection 'con1'.
+# Check that ALTER TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap ALTER TABLE
+#
+# 40) Test effect of implicit commit for DDL which is otherwise
+# compatible with FTWRL. Implicit commit at the start of DDL
+# statement can make it incompatible with FTWRL if there are
+# some changes to be commited even in case when DDL statement
+# itself is compatible with FTWRL.
+#
+# For example CHECK TABLE for base non-transactional tables and
+# ALTER TABLE for temporary non-transactional tables are affected.
+begin;
+insert into t3_trans values (1);
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+check table t1_base;
+# Switching to connection 'con1'.
+# Check that CHECK TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap CHECK TABLE
+Table Op Msg_type Msg_text
+test.t1_base check status OK
+begin;
+delete from t3_trans;
+#
+# Switching to connection 'con1'.
+flush tables with read lock;
+# Switching to connection 'default'.
+alter table t1_temp add column c1 int;
+# Switching to connection 'con1'.
+# Check that ALTER TABLE is blocked.
+unlock tables;
+# Switching to connection 'default'.
+# Reap ALTER TABLE
+alter table t1_temp drop column c1;
+#
+# Check that FLUSH TABLES WITH READ LOCK is blocked by individual
+# statements and is not blocked in the presence of transaction which
+# has done some changes earlier but is idle now (or does only reads).
+# This allows to use this statement even on systems which has long
+# running transactions.
+#
+begin;
+insert into t1_base values (1);
+insert into t3_trans values (1);
+# Switching to connection 'con1'.
+# The below FTWRL should not be blocked by transaction in 'default'.
+flush tables with read lock;
+# Switching to connection 'default'.
+# Transaction still is able to read even with FTWRL active in another
+# connection.
+select * from t1_base;
+i
+1
+select * from t2_base;
+j
+select * from t3_trans;
+i
+1
+# Switching to connection 'con1'.
+unlock tables;
+# Switching to connection 'default'.
+commit;
+delete from t1_base;
+delete from t3_trans;
+#
+# Check that impending FTWRL blocks new DML statements and
+# so can't be starved by a constant flow of DML.
+# (a.k.a. test for bug #54673 "It takes too long to get
+# readlock for 'FLUSH TABLES WITH READ LOCK'").
+#
+set debug_sync='RESET';
+set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
+insert into t1_base values (1);
+# Switching to connection 'con1'.
+set debug_sync='now WAIT_FOR parked';
+flush tables with read lock;
+# Switching to connection 'con2'.
+# Wait until FTWRL is blocked.
+# Try to run another INSERT and see that it is blocked.
+insert into t2_base values (1);;
+# Switching to connection 'con3'.
+# Wait until new INSERT is blocked.
+# Unblock INSERT in the first connection.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'default'.
+# Reap first INSERT.
+# Switching to connection 'con1'.
+# Reap FTWRL.
+unlock tables;
+# Switching to connection 'con2'.
+# Reap second INSERT.
+# Switching to connection 'default'.
+set debug_sync= "RESET";
+delete from t1_base;
+delete from t2_base;
+
+# Check that COMMIT thas is issued after
+# FLUSH TABLES WITH READ LOCK is not blocked by
+# FLUSH TABLES WITH READ LOCK from another connection.
+# This scenario is used in innobackup.pl. The COMMIT goes
+# through because the transaction started by FTWRL does
+# not modify any tables, and the commit blocker lock is
+# only taken when there were such modifications.
+
+flush tables with read lock;
+# Switching to connection 'con1'.
+# The below FTWRL should not be blocked by transaction in 'default'.
+flush tables with read lock;
+# Switching to connection 'default'.
+select * from t1_base;
+i
+select * from t3_trans;
+i
+commit;
+# Switching to connection 'con1'.
+select * from t1_base;
+i
+select * from t3_trans;
+i
+commit;
+unlock tables;
+# Switching to connection 'default'.
+unlock tables;
+#
+# Check how FLUSH TABLE WITH READ LOCK is handled for MERGE tables.
+# As usual there are tricky cases related to this type of tables.
+#
+#
+# 1) Most typical case - base MERGE table with base underlying tables.
+#
+# 1.a) DML statements which change data should be incompatible with FTWRL.
+create table tm_base (i int) engine=merge union=(t1_base) insert_method=last;
+Success: Was not able to run 'insert into tm_base values (1)' under FTWRL.
+Success: 'insert into tm_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into tm_base values (1)' is active in another connection.
+#
+# 1.b) DDL statement on such table should be incompatible with FTWRL as well.
+Success: Was not able to run 'alter table tm_base insert_method=first' under FTWRL.
+Success: 'alter table tm_base insert_method=first' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter table tm_base insert_method=first' is active in another connection.
+drop table tm_base;
+#
+# 2) Temporary MERGE table with base underlying tables.
+#
+# 2.a) DML statements which change data should be incompatible with FTWRL
+# as they affect base tables.
+create temporary table tm_temp_base (i int) engine=merge union=(t1_base) insert_method=last;
+Success: Was not able to run 'insert into tm_temp_base values (1)' under FTWRL.
+Success: 'insert into tm_temp_base values (1)' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'insert into tm_temp_base values (1)' is active in another connection.
+#
+# 2.b) Some of DDL statements on such table can be compatible with FTWRL
+# as they don't affect base tables.
+Success: Was able to run 'drop temporary tables tm_temp_base' under FTWRL.
+Success: Was able to run 'drop temporary tables tm_temp_base' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'drop temporary tables tm_temp_base' was active in another connection.
+#
+# 2.c) ALTER statement is incompatible with FTWRL. Even though it does
+# not change data in base table it still acquires strong metadata
+# locks on them.
+Success: Was not able to run 'alter table tm_temp_base insert_method=first' under FTWRL.
+Success: 'alter table tm_temp_base insert_method=first' is blocked by FTWRL active in another connection.
+Success: FTWRL is blocked when 'alter table tm_temp_base insert_method=first' is active in another connection.
+drop table tm_temp_base;
+#
+# 3) Temporary MERGE table with temporary underlying tables.
+#
+# 3.a) DML statements should be compatible with FTWRL as
+# no base table is going to be affected.
+create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last;
+Success: Was able to run 'insert into tm_temp_temp values (1)' under FTWRL.
+Success: Was able to run 'insert into tm_temp_temp values (1)' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'insert into tm_temp_temp values (1)' was active in another connection.
+#
+# 3.b) DDL statements should be compatible with FTWRL as well
+# as no base table is going to be affected too.
+Success: Was able to run 'alter table tm_temp_temp union=(t1_temp) insert_method=first' under FTWRL.
+Success: Was able to run 'alter table tm_temp_temp union=(t1_temp) insert_method=first' with FTWRL active in another connection.
+Success: Was able to run FTWRL while 'alter table tm_temp_temp union=(t1_temp) insert_method=first' was active in another connection.
+drop table tm_temp_temp;
+#
+# 4) For the sake of completeness let us check that base MERGE tables
+# with temporary underlying tables are not functional.
+create table tm_base_temp (i int) engine=merge union=(t1_temp) insert_method=last;
+select * from tm_base_temp;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+drop table tm_base_temp;
+#
+# Clean-up.
+#
+drop event e1;
+drop function f2_temp;
+drop function f2_base;
+drop procedure p2;
+drop view v1;
+drop function f1;
+drop procedure p1;
+drop database `#mysql50#mysqltest-2`;
+drop database mysqltest1;
+drop temporary tables t1_temp, t2_temp;
+drop tables t1_base, t2_base, t3_trans;
diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result
index b16a8b114b3..8453d26cbea 100644
--- a/mysql-test/r/flush_read_lock_kill.result
+++ b/mysql-test/r/flush_read_lock_kill.result
@@ -1,12 +1,38 @@
-SET @old_concurrent_insert= @@global.concurrent_insert;
-SET @@global.concurrent_insert= 0;
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (kill_id INT);
+SET DEBUG_SYNC= 'RESET';
+CREATE TABLE t1 (kill_id INT) engine = InnoDB;
INSERT INTO t1 VALUES(connection_id());
+# Switching to connection 'default'.
+# Start transaction.
+BEGIN;
+INSERT INTO t1 VALUES(connection_id());
+# Ensure that COMMIT will pause once it acquires protection
+# against its global read lock.
+SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
+# Sending:
+COMMIT;
+# Switching to 'con1'.
+# Wait till COMMIT acquires protection against global read
+# lock and pauses.
+SET DEBUG_SYNC='now WAIT_FOR acquired';
+# Sending:
FLUSH TABLES WITH READ LOCK;
-SELECT ((@id := kill_id) - kill_id) FROM t1;
+# Switching to 'con2'.
+SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
((@id := kill_id) - kill_id)
0
+# Wait till FLUSH TABLES WITH READ LOCK blocks due
+# to active COMMIT
+# Kill connection 'con1'.
KILL CONNECTION @id;
+# Switching to 'con1'.
+# Try to reap FLUSH TABLES WITH READ LOCK,
+# it fail due to killed statement and connection.
+Got one of the listed errors
+# Switching to 'con2'.
+# Resume COMMIT.
+SET DEBUG_SYNC='now SIGNAL go';
+# Switching to 'default'.
+# Reaping COMMIT.
DROP TABLE t1;
-SET @@global.concurrent_insert= @old_concurrent_insert;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 893c650dad4..a76abaa4544 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -660,4 +660,40 @@ Table Op Msg_type Msg_text
test.t1 repair status OK
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
+#
+# Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+SELECT 1 FROM t1 WHERE 1 >
+ALL((SELECT 1 FROM t1 JOIN t1 a
+ON (MATCH(t1.f1) against (""))
+WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+1
+1
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/func_analyse.result b/mysql-test/r/func_analyse.result
index 1820782d2f8..f82439090f6 100644
--- a/mysql-test/r/func_analyse.result
+++ b/mysql-test/r/func_analyse.result
@@ -123,3 +123,29 @@ CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
DROP TABLE t1;
End of 5.0 tests
+#
+# Bug#11765202: Dbug_violation_helper::~Dbug_violation_helper(): Assertion `!_entered' failed.
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (a VARCHAR(2) CHARSET UTF8 NOT NULL);
+INSERT INTO t1 VALUES ('e'),('e'),('e-');
+SELECT * FROM t1 PROCEDURE ANALYSE();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t1.a e e- 1 2 0 0 1.3333 NULL ENUM('e','e-') NOT NULL
+DROP TABLE t1;
+#
+# Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL
+#
+CREATE TABLE t1(f1 INT) ENGINE=MYISAM;
+CREATE TABLE t2(f2 INT) ENGINE=INNODB;
+INSERT INTO t2 VALUES (1);
+SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t1.f1 NULL NULL 0 0 0 1 0.0 0.0 CHAR(0)
+SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t2.f2 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
+DROP TABLE t1, t2;
+End of 5.1 tests
diff --git a/mysql-test/r/func_encrypt_ucs2.result b/mysql-test/r/func_encrypt_ucs2.result
new file mode 100644
index 00000000000..2ca40434cae
--- /dev/null
+++ b/mysql-test/r/func_encrypt_ucs2.result
@@ -0,0 +1,19 @@
+#
+# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
+#
+SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)));
+CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)))
+9
+SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED);
+CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
+CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)))
+4
+SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);
+CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'test'
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 302de9de9f7..6c400a8ddcc 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1038,6 +1038,25 @@ GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1,2,2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+#
+# Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
+#
+CREATE TABLE t1(f1 int);
+INSERT INTO t1 values (0),(0);
+SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
+ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `t`.`f1`) `d`)' value found during parsing
+DROP TABLE t1;
+#
+# Bug#58396 group_concat and explain extended are still crashy
+#
+CREATE TABLE t1(a INT);
+EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1')
+FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1);
+ERROR HY000: Only constant XPATH queries are supported
+SHOW WARNINGS;
+Level Code Message
+Error 1105 Only constant XPATH queries are supported
+DROP TABLE t1;
End of 5.1 tests
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a VARCHAR(6), b INT);
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 5e03f93e425..4f493ccd928 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1724,8 +1724,51 @@ m
1
DROP TABLE t1;
#
+# Bug#58030 crash in Item_func_geometry_from_text::val_str
+#
+SELECT MAX(TIMESTAMP(RAND(0)));
+SELECT MIN(TIMESTAMP(RAND(0)));
+#
+# Bug#58177 crash and valgrind warnings in decimal and protocol sending functions...
+#
+SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
+SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
+SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
+SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
+SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa');
+#
+# Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
+#
+CREATE TABLE t1 (a BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (18446668621106209655);
+SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1;
+MAX(LENGTH(a)) LENGTH(MAX(a)) MIN(a) MAX(a) CONCAT(MIN(a)) CONCAT(MAX(a))
+20 20 18446668621106209655 18446668621106209655 18446668621106209655 18446668621106209655
+DROP TABLE t1;
+#
+# Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
+#
+CREATE TABLE t1(f1 YEAR(4));
+INSERT INTO t1 VALUES (0000),(2001);
+(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63
+MAX(f1)
+2001
+DROP TABLE t1;
+#
End of 5.1 tests
#
+# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
+# file .\item_sum.cc, line 587
+#
+CREATE TABLE t1(a int, KEY(a));
+INSERT INTO t1 VALUES (1), (2);
+SELECT 1 FROM t1 ORDER BY AVG(DISTINCT a);
+1
+1
+DROP TABLE t1;
+#
# Bug#55648: Server crash on MIN/MAX on maximum time value
#
CREATE TABLE t1(c1 TIME NOT NULL);
@@ -1746,3 +1789,18 @@ MAX(c1) MIN(c1)
-00:00:01 -00:00:01
DROP TABLE t1;
# End of the bug#56120
+#
+# Bug#57932 "query with AVG(DISTINCT) returns NULL if last
+# aggregated value was NULL"
+#
+CREATE TABLE t1 (col_int_nokey int(11));
+INSERT INTO t1 VALUES (7),(8),(NULL);
+SELECT AVG(DISTINCT col_int_nokey) FROM t1;
+AVG(DISTINCT col_int_nokey)
+7.5000
+SELECT AVG(DISTINCT outr.col_int_nokey) FROM t1 AS outr LEFT JOIN t1 AS outr2 ON
+outr.col_int_nokey = outr2.col_int_nokey;
+AVG(DISTINCT outr.col_int_nokey)
+7.5000
+DROP TABLE t1;
+# End of the bug#57932
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index 908e85c1652..8412317c91d 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -145,3 +145,50 @@ select count(*), min(7), max(7) from t2m, t1i;
count(*) min(7) max(7)
0 NULL NULL
drop table t1m, t1i, t2m, t2i;
+#
+# Bug #57954: BIT_AND function returns incorrect results when
+# semijoin=on
+CREATE TABLE c (
+pk INT,
+col_varchar_key VARCHAR(1),
+PRIMARY KEY (pk),
+KEY col_varchar_key (col_varchar_key)
+) ENGINE=InnoDB;
+INSERT INTO c VALUES (11,NULL);
+INSERT INTO c VALUES (16,'c');
+CREATE TABLE bb (
+pk INT,
+col_varchar_key VARCHAR(1),
+PRIMARY KEY (pk),
+KEY col_varchar_key (col_varchar_key)
+) ENGINE=InnoDB;
+INSERT INTO bb VALUES (10,NULL);
+SELECT straight_join BIT_AND(c.pk)
+FROM
+bb, c
+WHERE c.col_varchar_key='ABC'
+ORDER BY c.pk;
+BIT_AND(c.pk)
+18446744073709551615
+DROP TABLE c,bb;
+#
+# Bug #58050: BIT_OR and BIT_XOR return incorrect results when
+# semijoin=on
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1, 1, 1);
+CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1, 1, NULL);
+SELECT t1.* FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
+pk b c
+SELECT BIT_OR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
+BIT_OR(t1.b)
+0
+SELECT BIT_AND(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
+BIT_AND(t1.b)
+18446744073709551615
+SELECT BIT_XOR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
+BIT_XOR(t1.b)
+0
+DROP TABLE t1, t2;
+End of 5.5 tests
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 3ca4d9c2da5..ed835aea611 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -770,4 +770,10 @@ CASE a WHEN a THEN a END
NULL
DROP TABLE t1;
#
+# Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
+#
+SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
+1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1)
+1
+#
End of 5.1 tests
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 552ff564a89..39590eb1c99 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -182,4 +182,9 @@ INSERT INTO t2 VALUES (1), (2), (3);
SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
1
DROP TABLE t1, t2;
+#
+# Bug#59149 valgrind warnings with "like .. escape .." function
+#
+SELECT '' LIKE '1' ESCAPE COUNT(1);
+ERROR HY000: Incorrect arguments to ESCAPE
End of 5.1 tests
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index ffd6d2fc5b2..cce6a4cbb3e 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -481,6 +481,18 @@ RAND(i)
0.15522042769493574
DROP TABLE t1;
#
+# Bug#57477 SIGFPE when dividing a huge number a negative number
+#
+SELECT -9999999999999999991 DIV -1;
+ERROR 22003: BIGINT value is out of range in '(-(9999999999999999991) DIV -(1))'
+SELECT -9223372036854775808 DIV -1;
+ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))'
+SELECT -9223372036854775808 MOD -1;
+-9223372036854775808 MOD -1
+0
+SELECT -9223372036854775808999 MOD -1;
+-9223372036854775808999 MOD -1
+0
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
ERROR 22003: BIGINT value is out of range in '(123456789012345678901234567890.123456789012345678901234567890 DIV 1)'
select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
@@ -489,6 +501,54 @@ SHOW WARNINGS;
Level Code Message
Warning 1292 Truncated incorrect DECIMAL value: ''
Error 1690 BIGINT value is out of range in '('123456789012345678901234567890.123456789012345678901234567890' DIV 1)'
+#
+# Bug#57810 case/when/then : Assertion failed: length || !scale
+#
+SELECT CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END;
+CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END
+NULL
+CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END) AS CHAR) as C;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `C` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR
+#
+CREATE TABLE t1 SELECT CEIL(LINESTRINGFROMWKB(1) DIV NULL);
+DROP TABLE t1;
+CREATE TABLE t1 SELECT FLOOR(LINESTRINGFROMWKB(1) DIV NULL);
+DROP TABLE t1;
+#
+# Bug#11765923 58937: MANY VALGRIND ERRORS AFTER GROUPING BY RESULT OF DECIMAL COLUMN FUNCTION
+#
+CREATE TABLE t1(f1 DECIMAL(22,1));
+INSERT INTO t1 VALUES (0),(1);
+SELECT ROUND(f1, f1) FROM t1;
+ROUND(f1, f1)
+0.0
+1.0
+SELECT ROUND(f1, f1) FROM t1 GROUP BY 1;
+ROUND(f1, f1)
+0.0
+1.0
+DROP TABLE t1;
+#
+# Bug#11764671 57533: UNINITIALISED VALUES IN COPY_AND_CONVERT (SQL_STRING.CC) WITH CERTAIN CHA
+#
+SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'));
+ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'))
+-4939092.0000
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+#
+# Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
+#
+SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
+SUM(DISTINCT (TRUNCATE((.1), NULL)))
+NULL
End of 5.1 tests
#
# Bug #8433: Overflow must be an error
@@ -600,3 +660,42 @@ NULL
SELECT -9223372036854775808 MOD -1;
-9223372036854775808 MOD -1
0
+#
+# Bug #57209 valgrind + Assertion failed: dst > buf
+#
+SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
+as foo;
+foo
+2
+#
+# Bug #58137 char(0) column cause:
+# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
+#
+CREATE TABLE t1(a char(0));
+INSERT INTO t1 (SELECT -pi());
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+#
+# Bug #59241 invalid memory read
+# in do_div_mod with doubly assigned variables
+#
+SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
+((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')))
+NULL
+Warnings:
+Warning 1366 Incorrect decimal value: '' for column '' at row -1
+#
+# Bug #59498 div function broken in mysql-trunk
+#
+SELECT 1 div null;
+1 div null
+NULL
+#
+# Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
+#
+select (1.175494351E-37 div 1.7976931348623157E+308);
+(1.175494351E-37 div 1.7976931348623157E+308)
+0
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: ''
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 7e4f9b7a2e7..514994ed27c 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -258,6 +258,12 @@ GREATEST(a, (SELECT b FROM t1 LIMIT 1))
3
1
DROP TABLE t1;
+SELECT INET_NTOA(0);
+INET_NTOA(0)
+0.0.0.0
+SELECT '1' IN ('1', INET_NTOA(0));
+'1' IN ('1', INET_NTOA(0))
+1
#
# Bug #52165: Assertion failed: file .\dtoa.c, line 465
#
@@ -267,4 +273,40 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1;
COALESCE(a) = COALESCE(b)
1
DROP TABLE t1;
-End of tests
+#
+# Bug #54461: crash with longblob and union or update with subquery
+#
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+LEAST(a, (SELECT b FROM t1 LIMIT 1))
+1
+2
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+GREATEST(a, (SELECT b FROM t1 LIMIT 1))
+2
+3
+1
+DROP TABLE t1;
+SELECT INET_NTOA(0);
+INET_NTOA(0)
+0.0.0.0
+SELECT '1' IN ('1', INET_NTOA(0));
+'1' IN ('1', INET_NTOA(0))
+1
+#
+# End of 5.1 tests
+#
+#
+# Bug #58199: name_const in the having clause crashes
+#
+CREATE TABLE t1 (a INT);
+SELECT 1 from t1 HAVING NAME_CONST('', a);
+ERROR HY000: Incorrect arguments to NAME_CONST
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
+#
+# End of tests
+#
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 14ebc8203ec..ba9500bff46 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -159,3 +159,45 @@ SELECT CONVERT( a USING latin1 ) FROM t2;
CONVERT( a USING latin1 )
DROP TABLE t1, t2;
+#
+# BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5
+#
+CREATE TABLE t1(days set('1','2','3','4','5','6','7'));
+INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7');
+
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days);
+days
+1,2,3,4,5,6,7
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN;
+days
+NULL
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(7, days);
+days
+1,2,3,4,5,6,7
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(8, days);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+
+DROP TABLE t1;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index f01d46a9f41..81fe2413725 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2603,6 +2603,34 @@ ORDER BY QUOTE(t1.a);
1
1
DROP TABLE t1;
+#
+# Bug#57913 large negative number to string conversion functions crash
+# Bug#57810 case/when/then : Assertion failed: length || !scale
+#
+SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1));
+'1' IN ('1', SUBSTRING(-9223372036854775809, 1))
+1
+SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3));
+CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3))
+1
+Warnings:
+Warning 1292 Truncated incorrect DECIMAL value: ''
+#
+# Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail
+# and other crashes
+#
+CREATE TABLE t1 ( a TEXT );
+SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'bug58165.txt';
+SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
+insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' )
+x
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1;
+SELECT * FROM t1;
+a
+aaaaaaaaaaaaaa
+DROP TABLE t1;
End of 5.1 tests
Start of 5.4 tests
SELECT format(12345678901234567890.123, 3);
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index e52c17b9648..fb647723756 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -136,7 +136,7 @@ dayname("1962-03-03") dayname("1962-03-03")+0
Saturday 5
select monthname("1972-03-04"),monthname("1972-03-04")+0;
monthname("1972-03-04") monthname("1972-03-04")+0
-March 3
+March 0
select time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
00|12|0|12|00|AM|12:00:00 AM|00|00:00:00
@@ -1273,6 +1273,24 @@ date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond)
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond)
1000-01-01 00:00:01.020000
+#
+# Bug #52315 part 2 : utc_date() crashes when system time > year 2037
+#
+SET TIMESTAMP=-147490000;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=2147483648;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=2147483646;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=2147483647;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=0;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=-1;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=1;
+SELECT UTC_TIMESTAMP();
+SET TIMESTAMP=0;
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)
@@ -1315,4 +1333,109 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
1
1
DROP TABLE t1;
+#
+# Bug #52160: crash and inconsistent results when grouping
+# by a function and column
+#
+CREATE TABLE t1(a CHAR(10) NOT NULL);
+INSERT INTO t1 VALUES (''),('');
+SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect time value: ''
+Warning 1292 Truncated incorrect time value: ''
+Warning 1292 Truncated incorrect time value: ''
+DROP TABLE t1;
+#
+# Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
+#
+SELECT STR_TO_DATE(SPACE(2),'1');
+STR_TO_DATE(SPACE(2),'1')
+0000-00-00
+#
+# Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
+#
+SET GLOBAL SQL_MODE='';
+DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
+SET GLOBAL SQL_MODE=DEFAULT;
+#
+# Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
+#
+SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
+FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
+NULL
+#
+# Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
+#
+SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
+CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025))
+NULL
+#
+# Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
+#
+SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
+ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
+NULL
+#
+# Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
+#
+SELECT DATE_FORMAT('0000-00-11', '%W');
+DATE_FORMAT('0000-00-11', '%W')
+NULL
+SELECT DATE_FORMAT('0000-00-11', '%a');
+DATE_FORMAT('0000-00-11', '%a')
+NULL
+SELECT DATE_FORMAT('0000-00-11', '%w');
+DATE_FORMAT('0000-00-11', '%w')
+NULL
+#
+# Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
+#
+SELECT MAKEDATE(11111111,1);
+MAKEDATE(11111111,1)
+NULL
+SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
+WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
+NULL
End of 5.1 tests
+#
+# Bug#57039: constant subtime expression returns incorrect result.
+#
+CREATE TABLE t1 (`date_date` datetime NOT NULL);
+INSERT INTO t1 VALUES ('2008-01-03 00:00:00'), ('2008-01-03 00:00:00');
+SELECT * FROM t1 WHERE date_date >= subtime(now(), "00:30:00");
+date_date
+SELECT * FROM t1 WHERE date_date <= addtime(date_add("2000-1-1", INTERVAL "1:1:1" HOUR_SECOND), "00:20:00");
+date_date
+DROP TABLE t1;
+#
+# Bug#57512 str_to_date crash...
+#
+SELECT WEEK(STR_TO_DATE(NULL,0));
+WEEK(STR_TO_DATE(NULL,0))
+NULL
+SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR);
+SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR)
+NULL
+#
+# BUG#59895 - setting storage engine to null segfaults mysqld
+#
+SELECT MONTHNAME(0), MONTHNAME(0) IS NULL, MONTHNAME(0) + 1;
+MONTHNAME(0) MONTHNAME(0) IS NULL MONTHNAME(0) + 1
+NULL 1 NULL
+SET storage_engine=NULL;
+ERROR 42000: Variable 'storage_engine' can't be set to the value of 'NULL'
+#
+# Bug #59686 crash in String::copy() with time data type
+#
+SELECT min(timestampadd(month, 1>'', from_days('%Z')));
+min(timestampadd(month, 1>'', from_days('%Z')))
+NULL
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '%Z'
+create table t1(a time);
+insert into t1 values ('00:00:00'),('00:01:00');
+select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
+1
+drop table t1;
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index a28f537b2de..6db63a6ada0 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1099,3 +1099,30 @@ HANDLER t1 READ a NEXT;
HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.0 tests.
+#
+# Bug #57323/11764487: myisam corruption with insert ignore
+# and invalid spatial data
+#
+CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
+SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
+INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+SELECT ASTEXT(a), ASTEXT(b) FROM t1;
+ASTEXT(a) ASTEXT(b)
+POINT(0 0) POINT(1 1)
+DROP TABLE t1;
+CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
+KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
+INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+INSERT IGNORE INTO t1 SET a=1, b=NULL;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+SELECT a, ASTEXT(b) FROM t1;
+a ASTEXT(b)
+0 POINT(1 1)
+DROP TABLE t1;
+End of 5.1 tests
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 5663f167d00..bfd0ddccb90 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -960,6 +960,18 @@ COUNT(*)
2
DROP TABLE t1, t2;
End of 5.0 tests
+#
+# Test for bug #58650 "Failing assertion: primary_key_no == -1 ||
+# primary_key_no == 0".
+#
+drop table if exists t1;
+# The minimal test case.
+create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a));
+drop table t1;
+# The original test case.
+create table t1 (a int not null, b linestring not null, unique key b (b(12)));
+create unique index a on t1(a);
+drop table t1;
create table `t1` (`col002` point)engine=myisam;
insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
@@ -1014,7 +1026,27 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
+create table t1(a polygon NOT NULL)engine=myisam;
+insert into t1 values (geomfromtext("point(0 1)"));
+insert into t1 values (geomfromtext("point(1 0)"));
+select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
+p
+NULL
+NULL
+drop table t1;
+#
+# Test for bug #59888 "debug assertion when attempt to create spatial index
+# on char > 31 bytes".
+#
+create table t1(a char(32) not null) engine=myisam;
+create spatial index i on t1 (a);
+ERROR 42000: A SPATIAL index may only contain a geometrical type column
+drop table t1;
End of 5.1 tests
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+CREATE SPATIAL INDEX i on t0 (a);
+ERROR 42000: A SPATIAL index may only contain a geometrical type column
+INSERT INTO t0 VALUES (1);
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
@@ -1043,5 +1075,5 @@ col2 LINESTRING,
SPATIAL INDEX i1 (col1, col2)
);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
-DROP TABLE t1;
-DROP TABLE t2;
+DROP TABLE t0, t1, t2;
+End of 5.5 tests
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index e80dcd9793f..a02c15c03fb 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -13,8 +13,48 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
grant delete on mysqltest.* to mysqltest_1@localhost;
select * from mysql.user where user="mysqltest_1";
-Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0
+Host localhost
+User mysqltest_1
+Password
+Select_priv N
+Insert_priv N
+Update_priv N
+Delete_priv N
+Create_priv N
+Drop_priv N
+Reload_priv N
+Shutdown_priv N
+Process_priv N
+File_priv N
+Grant_priv N
+References_priv N
+Index_priv N
+Alter_priv N
+Show_db_priv N
+Super_priv N
+Create_tmp_table_priv N
+Lock_tables_priv N
+Execute_priv N
+Repl_slave_priv N
+Repl_client_priv N
+Create_view_priv N
+Show_view_priv N
+Create_routine_priv N
+Alter_routine_priv N
+Create_user_priv N
+Event_priv N
+Trigger_priv N
+Create_tablespace_priv N
+ssl_type SPECIFIED
+ssl_cipher EDH-RSA-DES-CBC3-SHA
+x509_issuer
+x509_subject
+max_questions 0
+max_updates 0
+max_connections 0
+max_user_connections 0
+plugin
+authentication_string NULL
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
@@ -44,15 +84,95 @@ delete from mysql.user where user='mysqltest_1';
flush privileges;
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
select * from mysql.user where user="mysqltest_1";
-Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0
+Host localhost
+User mysqltest_1
+Password
+Select_priv N
+Insert_priv N
+Update_priv N
+Delete_priv N
+Create_priv N
+Drop_priv N
+Reload_priv N
+Shutdown_priv N
+Process_priv N
+File_priv N
+Grant_priv N
+References_priv N
+Index_priv N
+Alter_priv N
+Show_db_priv N
+Super_priv N
+Create_tmp_table_priv N
+Lock_tables_priv N
+Execute_priv N
+Repl_slave_priv N
+Repl_client_priv N
+Create_view_priv N
+Show_view_priv N
+Create_routine_priv N
+Alter_routine_priv N
+Create_user_priv N
+Event_priv N
+Trigger_priv N
+Create_tablespace_priv N
+ssl_type
+ssl_cipher
+x509_issuer
+x509_subject
+max_questions 10
+max_updates 0
+max_connections 0
+max_user_connections 0
+plugin
+authentication_string NULL
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
select * from mysql.user where user="mysqltest_1";
-Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin auth_string
-localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0
+Host localhost
+User mysqltest_1
+Password
+Select_priv N
+Insert_priv N
+Update_priv N
+Delete_priv N
+Create_priv N
+Drop_priv N
+Reload_priv N
+Shutdown_priv N
+Process_priv N
+File_priv N
+Grant_priv N
+References_priv N
+Index_priv N
+Alter_priv N
+Show_db_priv N
+Super_priv N
+Create_tmp_table_priv N
+Lock_tables_priv N
+Execute_priv N
+Repl_slave_priv N
+Repl_client_priv N
+Create_view_priv N
+Show_view_priv N
+Create_routine_priv N
+Alter_routine_priv N
+Create_user_priv N
+Event_priv N
+Trigger_priv N
+Create_tablespace_priv N
+ssl_type
+ssl_cipher
+x509_issuer
+x509_subject
+max_questions 10
+max_updates 20
+max_connections 30
+max_user_connections 0
+plugin
+authentication_string NULL
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
@@ -474,6 +594,7 @@ Index Tables To create or drop indexes
Insert Tables To insert data into tables
Lock tables Databases To use LOCK TABLES (together with SELECT privilege)
Process Server Admin To view the plain text of currently executing queries
+Proxy Server Admin To make proxy user possible
References Databases,Tables To have references on tables
Reload Server Admin To reload or refresh tables, logs and privileges
Replication client Server Admin To ask where the slave or master servers are
@@ -626,16 +747,19 @@ show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
flush privileges;
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
drop database ÂÄ;
revoke all privileges on ÂÄ.* from root@localhost;
show grants for root@localhost;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
set names latin1;
create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass');
@@ -1254,6 +1378,273 @@ CURRENT_USER()
root@localhost
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
+
+# Bug#57952
+
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+use mysqltest1;
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1, 1);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (2);
+CREATE TABLE mysqltest2.t3(a INT);
+INSERT INTO mysqltest2.t3 VALUES (4);
+CREATE USER testuser@localhost;
+GRANT CREATE ROUTINE, EXECUTE ON mysqltest1.* TO testuser@localhost;
+GRANT SELECT(b) ON t1 TO testuser@localhost;
+GRANT SELECT ON t2 TO testuser@localhost;
+GRANT SELECT ON mysqltest2.* TO testuser@localhost;
+
+# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1)
+PREPARE s1 FROM 'SELECT b FROM t1';
+PREPARE s2 FROM 'SELECT a FROM t2';
+PREPARE s3 FROM 'SHOW TABLES FROM mysqltest2';
+CREATE PROCEDURE p1() SELECT b FROM t1;
+CREATE PROCEDURE p2() SELECT a FROM t2;
+CREATE PROCEDURE p3() SHOW TABLES FROM mysqltest2;
+CALL p1;
+b
+1
+CALL p2;
+a
+2
+CALL p3;
+Tables_in_mysqltest2
+t3
+
+# Connection: default
+REVOKE SELECT ON t1 FROM testuser@localhost;
+GRANT SELECT(a) ON t1 TO testuser@localhost;
+REVOKE SELECT ON t2 FROM testuser@localhost;
+REVOKE SELECT ON mysqltest2.* FROM testuser@localhost;
+
+# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1)
+# - Check column-level privileges...
+EXECUTE s1;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1'
+SELECT b FROM t1;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1'
+EXECUTE s1;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1'
+CALL p1;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1'
+# - Check table-level privileges...
+SELECT a FROM t2;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2'
+EXECUTE s2;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2'
+CALL p2;
+ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table 't2'
+# - Check database-level privileges...
+SHOW TABLES FROM mysqltest2;
+ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2'
+EXECUTE s3;
+ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2'
+CALL p3;
+ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2'
+
+# Connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER testuser@localhost;
+use test;
+
+#
+# Test for bug #36544 "DROP USER does not remove stored function
+# privileges".
+#
+create database mysqltest1;
+create function mysqltest1.f1() returns int return 0;
+create procedure mysqltest1.p1() begin end;
+#
+# 1) Check that DROP USER properly removes privileges on both
+# stored procedures and functions.
+#
+create user mysqluser1@localhost;
+grant execute on function mysqltest1.f1 to mysqluser1@localhost;
+grant execute on procedure mysqltest1.p1 to mysqluser1@localhost;
+# Quick test that granted privileges are properly reflected
+# in privilege tables and in in-memory structures.
+show grants for mysqluser1@localhost;
+Grants for mysqluser1@localhost
+GRANT USAGE ON *.* TO 'mysqluser1'@'localhost'
+GRANT EXECUTE ON PROCEDURE `mysqltest1`.`p1` TO 'mysqluser1'@'localhost'
+GRANT EXECUTE ON FUNCTION `mysqltest1`.`f1` TO 'mysqluser1'@'localhost'
+select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
+db routine_name routine_type proc_priv
+mysqltest1 f1 FUNCTION Execute
+mysqltest1 p1 PROCEDURE Execute
+#
+# Create connection 'bug_36544_con1' as 'mysqluser1@localhost'.
+call mysqltest1.p1();
+select mysqltest1.f1();
+mysqltest1.f1()
+0
+#
+# Switch to connection 'default'.
+drop user mysqluser1@localhost;
+#
+# Test that dropping of user is properly reflected in
+# both privilege tables and in in-memory structures.
+#
+# Switch to connection 'bug36544_con1'.
+# The connection cold be alive but should not be able to
+# access to any of the stored routines.
+call mysqltest1.p1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1'
+select mysqltest1.f1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1'
+#
+# Switch to connection 'default'.
+#
+# Now create user with the same name and check that he
+# has not inherited privileges.
+create user mysqluser1@localhost;
+show grants for mysqluser1@localhost;
+Grants for mysqluser1@localhost
+GRANT USAGE ON *.* TO 'mysqluser1'@'localhost'
+select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
+db routine_name routine_type proc_priv
+#
+# Create connection 'bug_36544_con2' as 'mysqluser1@localhost'.
+# Newly created user should not be able to access any of the routines.
+call mysqltest1.p1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1'
+select mysqltest1.f1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1'
+#
+# Switch to connection 'default'.
+#
+# 2) Check that RENAME USER properly updates privileges on both
+# stored procedures and functions.
+#
+grant execute on function mysqltest1.f1 to mysqluser1@localhost;
+grant execute on procedure mysqltest1.p1 to mysqluser1@localhost;
+#
+# Create one more user to make in-memory hashes non-trivial.
+# User names 'mysqluser11' and 'mysqluser10' were selected
+# to trigger bug discovered during code inspection.
+create user mysqluser11@localhost;
+grant execute on function mysqltest1.f1 to mysqluser11@localhost;
+grant execute on procedure mysqltest1.p1 to mysqluser11@localhost;
+# Also create a couple of tables to test for another bug
+# discovered during code inspection (again table names were
+# chosen especially to trigger the bug).
+create table mysqltest1.t11 (i int);
+create table mysqltest1.t22 (i int);
+grant select on mysqltest1.t22 to mysqluser1@localhost;
+grant select on mysqltest1.t11 to mysqluser1@localhost;
+# Quick test that granted privileges are properly reflected
+# in privilege tables and in in-memory structures.
+show grants for mysqluser1@localhost;
+Grants for mysqluser1@localhost
+GRANT USAGE ON *.* TO 'mysqluser1'@'localhost'
+GRANT SELECT ON `mysqltest1`.`t11` TO 'mysqluser1'@'localhost'
+GRANT SELECT ON `mysqltest1`.`t22` TO 'mysqluser1'@'localhost'
+GRANT EXECUTE ON PROCEDURE `mysqltest1`.`p1` TO 'mysqluser1'@'localhost'
+GRANT EXECUTE ON FUNCTION `mysqltest1`.`f1` TO 'mysqluser1'@'localhost'
+select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
+db routine_name routine_type proc_priv
+mysqltest1 f1 FUNCTION Execute
+mysqltest1 p1 PROCEDURE Execute
+select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost';
+db table_name table_priv
+mysqltest1 t11 Select
+mysqltest1 t22 Select
+#
+# Switch to connection 'bug36544_con2'.
+call mysqltest1.p1();
+select mysqltest1.f1();
+mysqltest1.f1()
+0
+select * from mysqltest1.t11;
+i
+select * from mysqltest1.t22;
+i
+#
+# Switch to connection 'default'.
+rename user mysqluser1@localhost to mysqluser10@localhost;
+#
+# Test that there are no privileges left for mysqluser1.
+#
+# Switch to connection 'bug36544_con2'.
+# The connection cold be alive but should not be able to
+# access to any of the stored routines or tables.
+call mysqltest1.p1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1'
+select mysqltest1.f1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1'
+select * from mysqltest1.t11;
+ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11'
+select * from mysqltest1.t22;
+ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22'
+#
+# Switch to connection 'default'.
+#
+# Now create user with the old name and check that he
+# has not inherited privileges.
+create user mysqluser1@localhost;
+show grants for mysqluser1@localhost;
+Grants for mysqluser1@localhost
+GRANT USAGE ON *.* TO 'mysqluser1'@'localhost'
+select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
+db routine_name routine_type proc_priv
+select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost';
+db table_name table_priv
+#
+# Create connection 'bug_36544_con3' as 'mysqluser1@localhost'.
+# Newly created user should not be able to access to any of the
+# stored routines or tables.
+call mysqltest1.p1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1'
+select mysqltest1.f1();
+ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1'
+select * from mysqltest1.t11;
+ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11'
+select * from mysqltest1.t22;
+ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22'
+#
+# Switch to connection 'default'.
+#
+# Now check that privileges became associated with a new user
+# name - mysqluser10.
+#
+show grants for mysqluser10@localhost;
+Grants for mysqluser10@localhost
+GRANT USAGE ON *.* TO 'mysqluser10'@'localhost'
+GRANT SELECT ON `mysqltest1`.`t22` TO 'mysqluser10'@'localhost'
+GRANT SELECT ON `mysqltest1`.`t11` TO 'mysqluser10'@'localhost'
+GRANT EXECUTE ON PROCEDURE `mysqltest1`.`p1` TO 'mysqluser10'@'localhost'
+GRANT EXECUTE ON FUNCTION `mysqltest1`.`f1` TO 'mysqluser10'@'localhost'
+select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser10' and host='localhost';
+db routine_name routine_type proc_priv
+mysqltest1 f1 FUNCTION Execute
+mysqltest1 p1 PROCEDURE Execute
+select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10' and host='localhost';
+db table_name table_priv
+mysqltest1 t11 Select
+mysqltest1 t22 Select
+#
+# Create connection 'bug_36544_con4' as 'mysqluser10@localhost'.
+call mysqltest1.p1();
+select mysqltest1.f1();
+mysqltest1.f1()
+0
+select * from mysqltest1.t11;
+i
+select * from mysqltest1.t22;
+i
+#
+# Switch to connection 'default'.
+#
+# Clean-up.
+drop user mysqluser1@localhost;
+drop user mysqluser10@localhost;
+drop user mysqluser11@localhost;
+drop database mysqltest1;
End of 5.0 tests
set names utf8;
grant select on test.* to юзер_юзер@localhost;
@@ -1325,8 +1716,6 @@ CREATE USER 'userbug33464'@'localhost';
GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
userbug33464@localhost dbbug33464
-DROP PROCEDURE IF EXISTS sp3;
-DROP FUNCTION IF EXISTS fn1;
CREATE PROCEDURE sp3(v1 char(20))
BEGIN
SELECT * from dbbug33464.t6 where t6.f2= 'xyz';
@@ -1350,11 +1739,7 @@ fn2()
2
DROP USER 'userbug33464'@'localhost';
DROP FUNCTION fn1;
-Warnings:
-Warning 1403 There is no such grant defined for user 'userbug33464' on host 'localhost' on routine 'fn1'
DROP FUNCTION fn2;
-Warnings:
-Warning 1403 There is no such grant defined for user 'userbug33464' on host 'localhost' on routine 'fn2'
DROP PROCEDURE sp3;
DROP USER 'userbug33464'@'localhost';
USE test;
@@ -1454,6 +1839,17 @@ DROP USER 'testbug'@localhost;
DROP TABLE db2.t1;
DROP DATABASE db1;
DROP DATABASE db2;
+#
+# Bug #36742
+#
+grant usage on Foo.* to myuser@Localhost identified by 'foo';
+grant select on Foo.* to myuser@localhost;
+select host,user from mysql.user where User='myuser';
+host user
+localhost myuser
+revoke select on Foo.* from myuser@localhost;
+delete from mysql.user where User='myuser';
+flush privileges;
#########################################################################
#
# Bug#38347: ALTER ROUTINE privilege allows SHOW CREATE TABLE.
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 4758e2c9b22..a3323d51efb 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -11,7 +11,7 @@ grant create user on *.* to mysqltest_1@localhost;
create user mysqltest_2@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
-ERROR 42000: You must have privileges to update tables in the mysql database to be able to change passwords for others
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
grant update on mysql.* to mysqltest_1@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
grant select on `my\_1`.* to mysqltest_3@localhost;
@@ -335,7 +335,7 @@ delete from mysql.user where user like 'mysqltest\_1';
flush privileges;
drop database mysqltest_1;
set password = password("changed");
-ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
+ERROR 42000: Can't find any matching row in the user table
lock table mysql.user write;
flush privileges;
grant all on *.* to 'mysqltest_1'@'localhost';
diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result
index 59c64ee84ae..fd51a83d4b2 100644
--- a/mysql-test/r/grant3.result
+++ b/mysql-test/r/grant3.result
@@ -21,123 +21,108 @@ grant select on test.* to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
-CUser LOCALHOST test Y
CUser localhost test Y
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
-CUser localhost test Y
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
user host db select_priv
DROP USER CUser@localhost;
DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
create table t1 (a int);
grant select on test.t1 to CUser@localhost;
grant select on test.t1 to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser LOCALHOST test t1 Select
CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
DROP USER CUser@localhost;
DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
grant select(a) on test.t1 to CUser@localhost;
grant select(a) on test.t1 to CUser@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser LOCALHOST test t1 Select
CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
-CUser localhost test t1 Select
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
user host
-CUser LOCALHOST
CUser localhost
SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
user host db Table_name Table_priv Column_priv
DROP USER CUser@localhost;
DROP USER CUser@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser'@'localhost'
drop table t1;
grant select on test.* to CUser2@localhost;
grant select on test.* to CUser2@LOCALHOST;
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
user host
-CUser2 LOCALHOST
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
-CUser2 LOCALHOST test Y
CUser2 localhost test Y
REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST';
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
user host
-CUser2 LOCALHOST
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
-CUser2 localhost test Y
REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
+ERROR 42000: There is no such grant defined for user 'CUser2' on host 'localhost'
flush privileges;
SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
user host
-CUser2 LOCALHOST
CUser2 localhost
SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
user host db select_priv
DROP USER CUser2@localhost;
DROP USER CUser2@LOCALHOST;
+ERROR HY000: Operation DROP USER failed for 'CUser2'@'localhost'
CREATE DATABASE mysqltest_1;
CREATE TABLE mysqltest_1.t1 (a INT);
CREATE USER 'mysqltest1'@'%';
diff --git a/mysql-test/r/grant_cache_no_prot.result b/mysql-test/r/grant_cache_no_prot.result
index 32bb9cce90e..019edb72086 100644
--- a/mysql-test/r/grant_cache_no_prot.result
+++ b/mysql-test/r/grant_cache_no_prot.result
@@ -7,9 +7,11 @@ flush status;
show grants for current_user;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
create database if not exists mysqltest;
create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t2 (a int,b int,c int);
diff --git a/mysql-test/r/grant_cache_ps_prot.result b/mysql-test/r/grant_cache_ps_prot.result
index 281468ee2e1..e95a858fd9a 100644
--- a/mysql-test/r/grant_cache_ps_prot.result
+++ b/mysql-test/r/grant_cache_ps_prot.result
@@ -7,9 +7,11 @@ flush status;
show grants for current_user;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
create database if not exists mysqltest;
create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t2 (a int,b int,c int);
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index c1c14452bc2..12080ddf5a8 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1863,6 +1863,52 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a)
1111111111 1300
DROP TABLE t1;
+#
+# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+#
+CREATE TABLE t1(f1 INT NOT NULL);
+INSERT INTO t1 VALUES (16777214),(0);
+SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
+ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
+COUNT(*)
+2
+DROP TABLE t1;
+#
+# Bug#59839: Aggregation followed by subquery yields wrong result
+#
+CREATE TABLE t1 (
+a INT,
+b INT,
+c INT,
+KEY (a, b)
+);
+INSERT INTO t1 VALUES
+( 1, 1, 1 ),
+( 1, 2, 2 ),
+( 1, 3, 3 ),
+( 1, 4, 6 ),
+( 1, 5, 5 ),
+( 1, 9, 13 ),
+( 2, 1, 6 ),
+( 2, 2, 7 ),
+( 2, 3, 8 );
+EXPLAIN
+SELECT a, AVG(t1.b),
+(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
+(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
+FROM t1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL a 10 NULL 9 Using index
+3 DEPENDENT SUBQUERY t12 ref a a 10 func,func 2 Using where
+2 DEPENDENT SUBQUERY t11 ref a a 10 func,func 2 Using where
+SELECT a, AVG(t1.b),
+(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
+(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
+FROM t1 GROUP BY a;
+a AVG(t1.b) t11c t12c
+1 4.0000 6 6
+2 2.0000 7 7
+DROP TABLE t1;
# End of 5.1 tests
#
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
diff --git a/mysql-test/r/handler_innodb.result b/mysql-test/r/handler_innodb.result
index 121cfa89f1c..dd4cac669c8 100644
--- a/mysql-test/r/handler_innodb.result
+++ b/mysql-test/r/handler_innodb.result
@@ -1485,10 +1485,6 @@ ERROR 42S02: Table 'test.not_exists_write' doesn't exist
# We still have the read lock.
drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
-handler t1 read next;
-a b
-1 1
-handler t1 close;
handler t1 open;
select a from t2;
a
@@ -1726,7 +1722,22 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f1() = 1;
-ERROR 42S02: Table 'test.t2' doesn't exist
+ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ'
+HANDLER t1 CLOSE;
+DROP FUNCTION f1;
+DROP TABLE t1;
+#
+# Bug#54920 Stored functions are allowed in HANDLER statements,
+# but broken.
+#
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST WHERE f1() = 1;
+ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ'
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;
diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result
index fd08fd12f15..69d791b8263 100644
--- a/mysql-test/r/handler_myisam.result
+++ b/mysql-test/r/handler_myisam.result
@@ -1481,10 +1481,6 @@ ERROR 42S02: Table 'test.not_exists_write' doesn't exist
# We still have the read lock.
drop table t1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
-handler t1 read next;
-a b
-1 1
-handler t1 close;
handler t1 open;
select a from t2;
a
@@ -1722,7 +1718,22 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f1() = 1;
-ERROR 42S02: Table 'test.t2' doesn't exist
+ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ'
+HANDLER t1 CLOSE;
+DROP FUNCTION f1;
+DROP TABLE t1;
+#
+# Bug#54920 Stored functions are allowed in HANDLER statements,
+# but broken.
+#
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+HANDLER t1 OPEN;
+HANDLER t1 READ FIRST WHERE f1() = 1;
+ERROR 42000: This version of MySQL doesn't yet support 'stored functions in HANDLER ... READ'
HANDLER t1 CLOSE;
DROP FUNCTION f1;
DROP TABLE t1;
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 2f223f081c2..5838d3f01c2 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -549,4 +549,26 @@ FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
HAVING field1 < 7;
field1
DROP TABLE t1,t2;
+#
+# Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
+#
+CREATE TABLE t1 (f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1, 0), (2, 1), (3, 2);
+CREATE TABLE t2 (f1 INT, f2 INT);
+SELECT t1.f1
+FROM t1
+HAVING (3, 2) IN (SELECT f1, f2 FROM t2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+f1
+SELECT t1.f1
+FROM t1
+HAVING (3, 2) IN (SELECT 4, 2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+f1
+SELECT t1.f1
+FROM t1
+HAVING 2 IN (SELECT f2 FROM t2) AND t1.f1 >= 0
+ORDER BY t1.f1;
+f1
+DROP TABLE t1,t2;
End of 5.1 tests
diff --git a/mysql-test/r/implicit_char_to_num_conversion.result b/mysql-test/r/implicit_char_to_num_conversion.result
new file mode 100644
index 00000000000..8f24a6b293c
--- /dev/null
+++ b/mysql-test/r/implicit_char_to_num_conversion.result
@@ -0,0 +1,366 @@
+DROP TABLE IF EXISTS t5;
+CREATE TABLE t5(c1 BIT(2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (0), (1), (2);
+SELECT HEX(c1) FROM t5 ORDER BY c1;
+HEX(c1)
+0
+1
+2
+SELECT HEX(c1) FROM t5 WHERE c1 = b'1' ORDER BY c1;
+HEX(c1)
+1
+SELECT HEX(c1) FROM t5 WHERE c1 <=> b'1' ORDER BY c1;
+HEX(c1)
+1
+SELECT HEX(c1) FROM t5 WHERE c1 != b'1' ORDER BY c1;
+HEX(c1)
+0
+2
+SELECT HEX(c1) FROM t5 WHERE c1 >= '1' ORDER BY c1;
+HEX(c1)
+1
+2
+SELECT HEX(c1) FROM t5 WHERE c1 <= '1' ORDER BY c1;
+HEX(c1)
+0
+1
+SELECT HEX(c1) FROM t5 WHERE c1 < '1' ORDER BY c1;
+HEX(c1)
+0
+SELECT HEX(c1) FROM t5 WHERE c1 > '0' ORDER BY c1;
+HEX(c1)
+1
+2
+DROP TABLE t5;
+CREATE TABLE t5(c1 FLOAT(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (-10.10), (1), (0);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-10.10
+0.00
+1.00
+95.95
+SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
+c1
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '10.10' ORDER BY c1;
+c1
+-10.10
+0.00
+1.00
+SELECT c1 FROM t5 WHERE c1 != '1' ORDER BY c1;
+c1
+-10.10
+0.00
+95.95
+SELECT c1 FROM t5 WHERE c1 < '1' ORDER BY c1;
+c1
+-10.10
+0.00
+SELECT c1 FROM t5 WHERE c1 > '0' ORDER BY c1;
+c1
+1.00
+95.95
+DROP TABLE t5;
+CREATE TABLE t5(c1 TINYINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95), (10),(11),(-8);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-8
+10
+11
+95
+SELECT c1 FROM t5 WHERE c1 = '10' ORDER BY c1;
+c1
+10
+SELECT c1 FROM t5 WHERE c1 <=> '10' ORDER BY c1;
+c1
+10
+SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
+c1
+95
+SELECT c1 FROM t5 WHERE c1 <= '11' ORDER BY c1;
+c1
+-8
+10
+11
+SELECT c1 FROM t5 WHERE c1 != '-8' ORDER BY c1;
+c1
+10
+11
+95
+SELECT c1 FROM t5 WHERE c1 < '11' ORDER BY c1;
+c1
+-8
+10
+SELECT c1 FROM t5 WHERE c1 > '10' ORDER BY c1;
+c1
+11
+95
+DROP TABLE t5;
+CREATE TABLE t5(c1 SMALLINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (395), (-200), (100), (111);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-200
+100
+111
+395
+SELECT c1 FROM t5 WHERE c1 = '100' ORDER BY c1;
+c1
+100
+SELECT c1 FROM t5 WHERE c1 <=> '100' ORDER BY c1;
+c1
+100
+SELECT c1 FROM t5 WHERE c1 >= '395' ORDER BY c1;
+c1
+395
+SELECT c1 FROM t5 WHERE c1 <= '-200' ORDER BY c1;
+c1
+-200
+SELECT c1 FROM t5 WHERE c1 != '100' ORDER BY c1;
+c1
+-200
+111
+395
+SELECT c1 FROM t5 WHERE c1 < '111' ORDER BY c1;
+c1
+-200
+100
+SELECT c1 FROM t5 WHERE c1 > '111' ORDER BY c1;
+c1
+395
+DROP TABLE t5;
+CREATE TABLE t5(c1 MEDIUMINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (-8388607), (311),(215),(88608);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-8388607
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 = '311' ORDER BY c1;
+c1
+311
+SELECT c1 FROM t5 WHERE c1 <=> '311' ORDER BY c1;
+c1
+311
+SELECT c1 FROM t5 WHERE c1 >= '215' ORDER BY c1;
+c1
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 <= '88608' ORDER BY c1;
+c1
+-8388607
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 != '-8388607' ORDER BY c1;
+c1
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 < '215' ORDER BY c1;
+c1
+-8388607
+SELECT c1 FROM t5 WHERE c1 > '215' ORDER BY c1;
+c1
+311
+88608
+DROP TABLE t5;
+CREATE TABLE t5(c1 INT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (-2147483647), (1011),(15),(9388607);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-2147483647
+15
+1011
+9388607
+SELECT c1 FROM t5 WHERE c1 = '9388607' ORDER BY c1;
+c1
+9388607
+SELECT c1 FROM t5 WHERE c1 <=> '9388607' ORDER BY c1;
+c1
+9388607
+SELECT c1 FROM t5 WHERE c1 >= '15' ORDER BY c1;
+c1
+15
+1011
+9388607
+SELECT c1 FROM t5 WHERE c1 <= '1011' ORDER BY c1;
+c1
+-2147483647
+15
+1011
+SELECT c1 FROM t5 WHERE c1 != '-2147483647' ORDER BY c1;
+c1
+15
+1011
+9388607
+SELECT c1 FROM t5 WHERE c1 < '15' ORDER BY c1;
+c1
+-2147483647
+SELECT c1 FROM t5 WHERE c1 > '15' ORDER BY c1;
+c1
+1011
+9388607
+DROP TABLE t5;
+CREATE TABLE t5(c1 BIGINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (-9223372036854775807), (12011),(500),(3372036854775808);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-9223372036854775807
+500
+12011
+3372036854775808
+SELECT c1 FROM t5 WHERE c1 = '-9223372036854775807' ORDER BY c1;
+c1
+-9223372036854775807
+SELECT c1 FROM t5 WHERE c1 <=> '-9223372036854775807' ORDER BY c1;
+c1
+-9223372036854775807
+SELECT c1 FROM t5 WHERE c1 >= '12011' ORDER BY c1;
+c1
+12011
+3372036854775808
+SELECT c1 FROM t5 WHERE c1 <= '500' ORDER BY c1;
+c1
+-9223372036854775807
+500
+SELECT c1 FROM t5 WHERE c1 != '3372036854775808' ORDER BY c1;
+c1
+-9223372036854775807
+500
+12011
+SELECT c1 FROM t5 WHERE c1 < '12011' ORDER BY c1;
+c1
+-9223372036854775807
+500
+SELECT c1 FROM t5 WHERE c1 > '12011' ORDER BY c1;
+c1
+3372036854775808
+DROP TABLE t5;
+CREATE TABLE t5(c1 DOUBLE(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+DROP TABLE t5;
+CREATE TABLE t5(c1 NUMERIC(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+DROP TABLE t5;
+CREATE TABLE t5(c1 DECIMAL(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+DROP TABLE t5;
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index 0040221884e..1caf9be8ac2 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -1156,6 +1156,61 @@ key1 key2 key3
38 38 38
39 39 39
drop table t1;
+#
+# Bug#56423: Different count with SELECT and CREATE SELECT queries
+#
+CREATE TABLE t1 (
+a INT,
+b INT,
+c INT,
+d INT,
+PRIMARY KEY (a),
+KEY (c),
+KEY bd (b,d)
+);
+INSERT INTO t1 VALUES
+(1, 0, 1, 0),
+(2, 1, 1, 1),
+(3, 1, 1, 1),
+(4, 0, 1, 1);
+EXPLAIN
+SELECT a
+FROM t1
+WHERE c = 1 AND b = 1 AND d = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c,bd bd 10 const,const 2 Using where
+CREATE TABLE t2 ( a INT )
+SELECT a
+FROM t1
+WHERE c = 1 AND b = 1 AND d = 1;
+SELECT * FROM t2;
+a
+2
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1( a INT, b INT, KEY(a), KEY(b) );
+INSERT INTO t1 VALUES (1, 2), (1, 2), (1, 2), (1, 2);
+SELECT * FROM t1 FORCE INDEX(a, b) WHERE a = 1 AND b = 2;
+a b
+1 2
+1 2
+1 2
+1 2
+DROP TABLE t1;
+# Code coverage of fix.
+CREATE TABLE t1 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT);
+INSERT INTO t1 (b) VALUES (1);
+UPDATE t1 SET b = 2 WHERE a = 1;
+SELECT * FROM t1;
+a b
+1 2
+CREATE TABLE t2 ( a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(1) );
+INSERT INTO t2 (b) VALUES ('a');
+UPDATE t2 SET b = 'b' WHERE a = 1;
+SELECT * FROM t2;
+a b
+1 b
+DROP TABLE t1, t2;
#---------------- 2-sweeps read Index merge test 2 -------------------------------
SET SESSION STORAGE_ENGINE = MyISAM;
drop table if exists t1;
diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result
index 248b8d606dc..92408c439a5 100644
--- a/mysql-test/r/information_schema-big.result
+++ b/mysql-test/r/information_schema-big.result
@@ -30,6 +30,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -42,6 +43,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
@@ -74,6 +76,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -86,6 +89,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 9ed397bbe1e..c9bac8be27f 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -94,6 +94,7 @@ host
plugin
proc
procs_priv
+proxies_priv
servers
slow_log
t1
@@ -696,6 +697,7 @@ Alter_routine_priv select,insert,update,references
max_questions select,insert,update,references
max_connections select,insert,update,references
max_user_connections select,insert,update,references
+authentication_string select,insert,update,references
use test;
create function sub1(i int) returns int
return i+1;
@@ -1770,3 +1772,47 @@ USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1';
TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+#
+# A test case for Bug#56540 "Exception (crash) in sql_show.cc
+# during rqg_info_schema test on Windows"
+# Ensure that we never access memory of a closed table,
+# in particular, never access table->field[] array.
+# Before the fix, the below test case, produced
+# valgrind errors.
+#
+drop table if exists t1;
+drop view if exists v1;
+create table t1 (a int, b int);
+create view v1 as select t1.a, t1.b from t1;
+alter table t1 change b c int;
+lock table t1 read;
+# --> connection con1
+flush tables;
+# --> connection default
+select * from information_schema.views;
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME v1
+VIEW_DEFINITION select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
+CHECK_OPTION NONE
+IS_UPDATABLE
+DEFINER root@localhost
+SECURITY_TYPE DEFINER
+CHARACTER_SET_CLIENT latin1
+COLLATION_CONNECTION latin1_swedish_ci
+Warnings:
+Level Warning
+Code 1356
+Message View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+unlock tables;
+#
+# Cleanup.
+#
+# --> connection con1
+# Reaping 'flush tables'
+# --> connection default
+drop table t1;
+drop view v1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/init_file.result b/mysql-test/r/init_file.result
index 43ed908ad01..6394014f3e5 100644
--- a/mysql-test/r/init_file.result
+++ b/mysql-test/r/init_file.result
@@ -21,4 +21,3 @@ y
11
13
drop table t1, t2;
-call mtr.force_restart();
diff --git a/mysql-test/r/innodb_mysql_lock.result b/mysql-test/r/innodb_mysql_lock.result
index bf1c3a89f40..4c7e7f11987 100644
--- a/mysql-test/r/innodb_mysql_lock.result
+++ b/mysql-test/r/innodb_mysql_lock.result
@@ -148,3 +148,27 @@ COMMIT;
# Connection default
DROP TABLE t1, t2;
DROP VIEW v1;
+#
+# Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
+# KEY NO 0 FOR TABLE IN ERROR LOG
+#
+DROP TABLE IF EXISTS t1;
+# Connection default
+CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1, 12345);
+START TRANSACTION;
+SELECT * FROM t1;
+id value
+1 12345
+# Connection con1
+SET lock_wait_timeout=1;
+ALTER TABLE t1 ADD INDEX idx(value);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ALTER TABLE t1 ADD INDEX idx(value);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection default
+SELECT * FROM t1;
+id value
+1 12345
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result
index 43a98829d4e..605aaf4df5a 100644
--- a/mysql-test/r/innodb_mysql_sync.result
+++ b/mysql-test/r/innodb_mysql_sync.result
@@ -66,3 +66,123 @@ SELECT ((@id := id) - id) FROM t2;
KILL @id;
SET DEBUG_SYNC= "now SIGNAL killed";
DROP TABLE t1, t2;
+SET DEBUG_SYNC= "RESET";
+#
+# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
+# OPTIMIZE TABLE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+# Connection con1
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection default
+SET DEBUG_SYNC= 'now WAIT_FOR waiting';
+KILL QUERY ID;
+SET DEBUG_SYNC= 'now SIGNAL killed';
+# Connection con1
+# Reaping: OPTIMIZE TABLE t1
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status Operation failed
+# Connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+#
+# Bug#42230 during add index, cannot do queries on storage engines
+# that implement add_index
+#
+DROP DATABASE IF EXISTS db1;
+DROP TABLE IF EXISTS t1;
+# Test 1: Secondary index, should not block reads (original test case).
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
+INSERT INTO db1.t1(value) VALUES (1), (2);
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE db1.t1 ADD INDEX(value);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+USE db1;
+SELECT * FROM t1;
+id value
+1 1
+2 2
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
+DROP DATABASE db1;
+# Test 2: Primary index (implicit), should block reads.
+CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE t1 ADD UNIQUE INDEX(a);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+USE test;
+# Sending:
+SELECT * FROM t1;
+# Connection con2
+# Waiting for SELECT to be blocked by the metadata lock on t1
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
+# Connection con1
+# Reaping: SELECT * FROM t1
+a b
+# Test 3: Primary index (explicit), should block reads.
+# Connection default
+ALTER TABLE t1 DROP INDEX a;
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+# Sending:
+SELECT * FROM t1;
+# Connection con2
+# Waiting for SELECT to be blocked by the metadata lock on t1
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
+# Connection con1
+# Reaping: SELECT * FROM t1
+a b
+# Test 4: Secondary unique index, should not block reads.
+# Connection default
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE t1 ADD UNIQUE (b);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+SELECT * FROM t1;
+a b
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE t1 ADD UNIQUE (b)
+SET DEBUG_SYNC= "RESET";
+DROP TABLE t1;
+#
+# Bug#11853126 RE-ENABLE CONCURRENT READS WHILE CREATING SECONDARY INDEX
+# IN INNODB
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
+INSERT INTO t1 VALUES (1, 12345), (2, 23456);
+# Connection con1
+SET SESSION debug= "+d,alter_table_rollback_new_index";
+ALTER TABLE t1 ADD PRIMARY KEY(a);
+ERROR HY000: Unknown error
+SELECT * FROM t1;
+a b
+1 12345
+2 23456
+# Connection default
+SELECT * FROM t1;
+a b
+1 12345
+2 23456
+DROP TABLE t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index e6655e155db..538d6ddd0fd 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -843,7 +843,7 @@ SET max_heap_table_size = 16384;
SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
SET GLOBAL myisam_data_pointer_size = 2;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-call mtr.add_suppression("mysqld: The table '.*#sql.*' is full");
+call mtr.add_suppression("mysqld.*: The table '.*#sql.*' is full");
INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
DROP TABLE t1;
diff --git a/mysql-test/r/ipv4_as_ipv6.result b/mysql-test/r/ipv4_as_ipv6.result
index 8523dc82f02..82bca393d71 100644
--- a/mysql-test/r/ipv4_as_ipv6.result
+++ b/mysql-test/r/ipv4_as_ipv6.result
@@ -32,9 +32,9 @@ mysqld is alive
CREATE USER testuser@'0:0:0:0:0:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0:0:0:0:0:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0:0:0:0:0:FFFF:127.0.0.1';
-Grants for testuser@0:0:0:0:0:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0:0:0:0:0:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0:0:0:0:FFFF:127.0.0.1'
+Grants for testuser@0:0:0:0:0:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0:0:0:0:0:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0:0:0:0:ffff:127.0.0.1'
SET @nip= inet_aton('0:0:0:0:0:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -61,9 +61,9 @@ mysqld is alive
CREATE USER testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0000:0000:0000:0000:0000:FFFF:127.0.0.1';
-Grants for testuser@0000:0000:0000:0000:0000:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0000:0000:0000:0000:0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0000:0000:0000:0000:0000:FFFF:127.0.0.1'
+Grants for testuser@0000:0000:0000:0000:0000:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0000:0000:0000:0000:0000:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0000:0000:0000:0000:0000:ffff:127.0.0.1'
SET @nip= inet_aton('0000:0000:0000:0000:0000:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -90,9 +90,9 @@ mysqld is alive
CREATE USER testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0:0000:0000:0:0000:FFFF:127.0.0.1';
-Grants for testuser@0:0000:0000:0:0000:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0:0000:0000:0:0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0000:0000:0:0000:FFFF:127.0.0.1'
+Grants for testuser@0:0000:0000:0:0000:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0:0000:0000:0:0000:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0:0000:0000:0:0000:ffff:127.0.0.1'
SET @nip= inet_aton('0:0000:0000:0:0000:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -119,9 +119,9 @@ mysqld is alive
CREATE USER testuser@'0::0000:FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'0::0000:FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'0::0000:FFFF:127.0.0.1';
-Grants for testuser@0::0000:FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'0::0000:FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0::0000:FFFF:127.0.0.1'
+Grants for testuser@0::0000:ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'0::0000:ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'0::0000:ffff:127.0.0.1'
SET @nip= inet_aton('0::0000:FFFF:127.0.0.1');
SELECT @nip;
@nip
@@ -149,9 +149,9 @@ mysqld is alive
CREATE USER testuser@'::FFFF:127.0.0.1' identified by '1234';
GRANT ALL ON test.* TO testuser@'::FFFF:127.0.0.1';
SHOW GRANTS FOR testuser@'::FFFF:127.0.0.1';
-Grants for testuser@::FFFF:127.0.0.1
-GRANT USAGE ON *.* TO 'testuser'@'::FFFF:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
-GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'::FFFF:127.0.0.1'
+Grants for testuser@::ffff:127.0.0.1
+GRANT USAGE ON *.* TO 'testuser'@'::ffff:127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF'
+GRANT ALL PRIVILEGES ON `test`.* TO 'testuser'@'::ffff:127.0.0.1'
SET @nip= inet_aton('::FFFF:127.0.0.1');
SELECT @nip;
@nip
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 5e896dc93ed..98735e9b05a 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1403,6 +1403,247 @@ Warnings:
Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1)) left join `test`.`t1` `jt1` on(1) where 1
DROP TABLE t1;
#
+# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+#
+CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
+INSERT INTO t1 VALUES (4);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (7, 7);
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+f1 f1 f2
+4 NULL NULL
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using filesort
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+f1 f1 f2
+DROP TABLE t1,t2;
+#
+# Bug#57034 incorrect OUTER JOIN result when joined on unique key
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY,
+col_int INT,
+col_int_unique INT UNIQUE KEY);
+INSERT INTO t1 VALUES (1,NULL,2), (2,0,0);
+CREATE TABLE t2 (pk INT PRIMARY KEY,
+col_int INT,
+col_int_unique INT UNIQUE KEY);
+INSERT INTO t2 VALUES (1,0,1), (2,0,2);
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int
+WHERE t1.pk=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t2 const col_int_unique col_int_unique 5 const 1
+SELECT * FROM t1 LEFT JOIN t2
+ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int
+WHERE t1.pk=1;
+pk col_int col_int_unique pk col_int col_int_unique
+1 NULL 2 NULL NULL NULL
+DROP TABLE t1,t2;
+#
+# Bug#48046 Server incorrectly processing JOINs on NULL values
+#
+CREATE TABLE `BB` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`time_key` time DEFAULT NULL,
+`varchar_key` varchar(1) DEFAULT NULL,
+`varchar_nokey` varchar(1) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `time_key` (`time_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES (10,'18:27:58',NULL,NULL);
+SELECT table1.time_key AS field1, table2.pk
+FROM BB table1 LEFT JOIN BB table2
+ON table2.varchar_nokey = table1.varchar_key
+HAVING field1;
+field1 pk
+18:27:58 NULL
+DROP TABLE BB;
+#
+# Bug#49600 Server incorrectly processing RIGHT JOIN with
+# constant WHERE clause and no index
+#
+CREATE TABLE `BB` (
+`col_datetime_key` datetime DEFAULT NULL,
+`col_varchar_key` varchar(1) DEFAULT NULL,
+`col_varchar_nokey` varchar(1) DEFAULT NULL,
+KEY `col_datetime_key` (`col_datetime_key`),
+KEY `col_varchar_key` (`col_varchar_key`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES ('1900-01-01 00:00:00',NULL,NULL);
+SELECT table1.col_datetime_key
+FROM BB table1 RIGHT JOIN BB table2
+ON table2 .col_varchar_nokey = table1.col_varchar_key
+WHERE 7;
+col_datetime_key
+NULL
+ALTER TABLE BB DISABLE KEYS;
+SELECT table1.col_datetime_key
+FROM BB table1 RIGHT JOIN BB table2
+ON table2 .col_varchar_nokey = table1.col_varchar_key
+WHERE 7;
+col_datetime_key
+NULL
+DROP TABLE BB;
+#
+# Bug#58490: Incorrect result in multi level OUTER JOIN
+# in combination with IS NULL
+#
+CREATE TABLE t1 (i INT NOT NULL);
+INSERT INTO t1 VALUES (0), (2),(3),(4);
+CREATE TABLE t2 (i INT NOT NULL);
+INSERT INTO t2 VALUES (0),(1), (3),(4);
+CREATE TABLE t3 (i INT NOT NULL);
+INSERT INTO t3 VALUES (0),(1),(2), (4);
+CREATE TABLE t4 (i INT NOT NULL);
+INSERT INTO t4 VALUES (0),(1),(2),(3) ;
+SELECT * FROM
+t1 LEFT JOIN
+( t2 LEFT JOIN
+( t3 LEFT JOIN
+t4
+ON t4.i = t3.i
+)
+ON t3.i = t2.i
+)
+ON t2.i = t1.i
+;
+i i i i
+0 0 0 0
+2 NULL NULL NULL
+3 3 NULL NULL
+4 4 4 NULL
+SELECT * FROM
+t1 LEFT JOIN
+( t2 LEFT JOIN
+( t3 LEFT JOIN
+t4
+ON t4.i = t3.i
+)
+ON t3.i = t2.i
+)
+ON t2.i = t1.i
+WHERE t4.i IS NULL;
+i i i i
+2 NULL NULL NULL
+3 3 NULL NULL
+4 4 4 NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i i i
+2 NULL NULL
+3 3 NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+JOIN t4
+ON t4.i=t2.i
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i i i i
+2 NULL NULL NULL
+3 3 NULL 3
+4 NULL NULL NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+JOIN (t4 AS t4a JOIN t4 AS t4b ON t4a.i=t4b.i)
+ON t4a.i=t2.i
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i i i i i
+2 NULL NULL NULL NULL
+3 3 NULL 3 3
+4 NULL NULL NULL NULL
+SELECT * FROM
+t1 LEFT JOIN
+( ( t2 LEFT JOIN
+t3
+ON t3.i = t2.i
+)
+JOIN (t4 AS t4a, t4 AS t4b)
+ON t4a.i=t2.i
+)
+ON t2.i = t1.i
+WHERE t3.i IS NULL;
+i i i i i
+2 NULL NULL NULL NULL
+3 3 NULL 3 0
+3 3 NULL 3 1
+3 3 NULL 3 2
+3 3 NULL 3 3
+4 NULL NULL NULL NULL
+DROP TABLE t1,t2,t3,t4;
+#
+# Bug#49322(Duplicate): Server is adding extra NULL row
+# on processing a WHERE clause
+#
+CREATE TABLE h (pk INT NOT NULL, col_int_key INT);
+INSERT INTO h VALUES (1,NULL),(4,2),(5,2),(3,4),(2,8);
+CREATE TABLE m (pk INT NOT NULL, col_int_key INT);
+INSERT INTO m VALUES (1,2),(2,7),(3,5),(4,7),(5,5),(6,NULL),(7,NULL),(8,9);
+CREATE TABLE k (pk INT NOT NULL, col_int_key INT);
+INSERT INTO k VALUES (1,9),(2,2),(3,5),(4,2),(5,7),(6,0),(7,5);
+SELECT TABLE1.pk FROM k TABLE1
+RIGHT JOIN h TABLE2 ON TABLE1.col_int_key=TABLE2.col_int_key
+RIGHT JOIN m TABLE4 ON TABLE2.col_int_key=TABLE4.col_int_key;
+pk
+2
+4
+2
+4
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+SELECT TABLE1.pk FROM k TABLE1
+RIGHT JOIN h TABLE2 ON TABLE1.col_int_key=TABLE2.col_int_key
+RIGHT JOIN m TABLE4 ON TABLE2.col_int_key=TABLE4.col_int_key
+WHERE TABLE1.pk IS NULL;
+pk
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+DROP TABLE h,m,k;
# Bug#49600: outer join of two single-row tables with joining attributes
# evaluated to nulls
create table t1 (a int, b int);
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
index 56e557ec881..e27139e83e7 100644
--- a/mysql-test/r/join_outer_innodb.result
+++ b/mysql-test/r/join_outer_innodb.result
@@ -17,3 +17,38 @@ 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 t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
+#
+# BUG#58456: Assertion 0 in QUICK_INDEX_MERGE_SELECT::need_sorted_output
+# in opt_range.h
+#
+CREATE TABLE t1 (
+col_int INT,
+col_int_key INT,
+pk INT NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1,1), (6,2,2), (5,3,3), (NULL,4,4);
+INSERT INTO t1 VALUES (1,NULL,6), (8,5,7), (NULL,8,8), (8,NULL,5);
+CREATE TABLE t2 (
+pk INT PRIMARY KEY
+) ENGINE=InnoDB;
+
+EXPLAIN SELECT t1.pk
+FROM t2 LEFT JOIN t1 ON t2.pk = t1.col_int
+WHERE t1.col_int_key BETWEEN 5 AND 6
+AND t1.pk IS NULL OR t1.pk IN (5)
+ORDER BY pk;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY,col_int_key PRIMARY 4 const 2 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.col_int 1 Using index
+
+SELECT t1.pk
+FROM t2 LEFT JOIN t1 ON t2.pk = t1.col_int
+WHERE t1.col_int_key BETWEEN 5 AND 6
+AND t1.pk IS NULL OR t1.pk IN (5)
+ORDER BY pk;
+pk
+
+DROP TABLE t1,t2;
+# End BUG#58456
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 5f338ad6a62..58cb7430563 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -45,3 +45,227 @@ p1
max=1
drop procedure p1;
drop table t1;
+CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO slow(slow, general) VALUES (1,2), (5,6);
+INSERT INTO slow(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM slow ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM slow ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE slow;
+CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO general(slow, general) VALUES (1,2), (5,6);
+INSERT INTO general(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM general ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM general ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE general;
+CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6);
+INSERT INTO master_heartbeat_period(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM master_heartbeat_period ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE master_heartbeat_period;
+CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
+INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
+INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
+INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6);
+INSERT INTO ignore_server_ids(slow) VALUES (1), (5);
+SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow;
+slow general master_heartbeat_period ignore_server_ids
+1 2 3 4
+1 2 3 NULL
+1 2 NULL NULL
+1 NULL NULL NULL
+5 6 7 8
+5 6 7 NULL
+5 6 NULL NULL
+5 NULL NULL NULL
+SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
+slow general master_heartbeat_period
+1 2 3
+1 2 3
+1 2 NULL
+1 NULL NULL
+5 6 7
+5 6 7
+5 6 NULL
+5 NULL NULL
+SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
+slow master_heartbeat_period
+1 3
+1 3
+1 NULL
+1 NULL
+5 7
+5 7
+5 NULL
+5 NULL
+SELECT slow FROM ignore_server_ids ORDER BY slow;
+slow
+1
+1
+1
+1
+5
+5
+5
+5
+DROP TABLE ignore_server_ids;
+CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT);
+INSERT INTO t1 VALUES (1,2,3,4);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE slow INT;
+DECLARE general INT;
+DECLARE ignore_server_ids INT;
+DECLARE master_heartbeat_period INT;
+SELECT max(t1.slow) INTO slow FROM t1;
+SELECT max(t1.general) INTO general FROM t1;
+SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1;
+SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1;
+SELECT slow, general, ignore_server_ids, master_heartbeat_period;
+END|
+CREATE PROCEDURE p2()
+BEGIN
+DECLARE n INT DEFAULT 2;
+general: WHILE n > 0 DO
+SET n = n -1;
+END WHILE general;
+SET n = 2;
+slow: WHILE n > 0 DO
+SET n = n -1;
+END WHILE slow;
+SET n = 2;
+ignore_server_ids: WHILE n > 0 DO
+SET n = n -1;
+END WHILE ignore_server_ids;
+SET n = 2;
+master_heartbeat_period: WHILE n > 0 DO
+SET n = n -1;
+END WHILE master_heartbeat_period;
+END|
+CALL p1();
+slow general ignore_server_ids master_heartbeat_period
+1 2 3 4
+call p2();
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP TABLE t1;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index 1f4f4bb32eb..964f2947f6a 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -1,143 +1,178 @@
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
-drop table if exists t1, t2, t3;
-create table t1 (kill_id int);
-insert into t1 values(connection_id());
-select ((@id := kill_id) - kill_id) from t1;
-((@id := kill_id) - kill_id)
-0
-kill @id;
-select ((@id := kill_id) - kill_id) from t1;
-((@id := kill_id) - kill_id)
-0
-select @id != connection_id();
-@id != connection_id()
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP FUNCTION IF EXISTS MY_KILL;
+CREATE FUNCTION MY_KILL(tid INT) RETURNS INT
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+KILL tid;
+RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid);
+END|
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
+SET DEBUG_SYNC='now WAIT_FOR con1_read';
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+SET DEBUG_SYNC = 'RESET';
+SELECT 1;
+Got one of the listed errors
+SELECT 1;
+1
1
-select 4;
+SELECT @id != CONNECTION_ID();
+@id != CONNECTION_ID()
+1
+SELECT 4;
4
4
-drop table t1;
-kill (select count(*) from mysql.user);
+KILL (SELECT COUNT(*) FROM mysql.user);
ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
-create table t1 (id int primary key);
-create table t2 (id int unsigned not null);
-insert into t2 select id from t1;
-create table t3 (kill_id int);
-insert into t3 values(connection_id());
-select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
-select ((@id := kill_id) - kill_id) from t3;
-((@id := kill_id) - kill_id)
-0
-kill @id;
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
+SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+SET DEBUG_SYNC = 'RESET';
+SELECT 1;
Got one of the listed errors
-drop table t1, t2, t3;
-select get_lock("a", 10);
-get_lock("a", 10)
-1
-select get_lock("a", 10);
-get_lock("a", 10)
-NULL
-select 1;
-1
-1
-select RELEASE_LOCK("a");
-RELEASE_LOCK("a")
-1
-create table t1(f1 int);
-create function bug27563() returns int(11)
-deterministic
-begin
-declare continue handler for sqlstate '70100' set @a:= 'killed';
-declare continue handler for sqlexception set @a:= 'exception';
-set @a= get_lock("lock27563", 10);
-return 1;
-end|
-select get_lock("lock27563",10);
-get_lock("lock27563",10)
-1
-insert into t1 values (bug27563());
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SELECT 1;
+1
+1
+SELECT @id != CONNECTION_ID();
+@id != CONNECTION_ID()
+1
+SELECT 4;
+4
+4
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE t2 (id INT UNSIGNED NOT NULL);
+INSERT INTO t1 VALUES
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0);
+INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032;
+INSERT INTO t2 SELECT id FROM t1;
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
+SELECT id FROM t1 WHERE id IN
+(SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
+GROUP BY ACOS(1/a.id), b.id, c.id, d.id
+HAVING a.id BETWEEN 10 AND 20);
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL @id;
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+Got one of the listed errors
+SELECT 1;
+1
+1
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
+SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
+SELECT ACOS(0);
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ACOS(0)
+1.5707963267948966
+SELECT 1;
+1
+1
+SELECT @id = CONNECTION_ID();
+@id = CONNECTION_ID()
+1
+SET DEBUG_SYNC = 'RESET';
+CREATE TABLE t1 (f1 INT);
+CREATE FUNCTION bug27563() RETURNS INT(11)
+DETERMINISTIC
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
+RETURN 1;
+END|
+INSERT INTO t1 VALUES (bug27563());
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SELECT * FROM t1;
f1
-insert into t1 values(0);
-update t1 set f1= bug27563();
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 VALUES(0);
+UPDATE t1 SET f1= bug27563();
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SELECT * FROM t1;
f1
0
-insert into t1 values(1);
-delete from t1 where bug27563() is null;
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 VALUES(1);
+DELETE FROM t1 WHERE bug27563() IS NULL;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SELECT * FROM t1;
f1
0
1
-select * from t1 where f1= bug27563();
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-create procedure proc27563()
-begin
-declare continue handler for sqlstate '70100' set @a:= 'killed';
-declare continue handler for sqlexception set @a:= 'exception';
-select get_lock("lock27563",10);
-select "shouldn't be selected";
-end|
-call proc27563();
-get_lock("lock27563",10)
-NULL
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-create table t2 (f2 int);
-create trigger trg27563 before insert on t1 for each row
-begin
-declare continue handler for sqlstate '70100' set @a:= 'killed';
-declare continue handler for sqlexception set @a:= 'exception';
-set @a:= get_lock("lock27563",10);
-insert into t2 values(1);
-end|
-insert into t1 values(2),(3);
-ERROR 70100: Query execution was interrupted
-select @a;
-@a
-NULL
-select * from t1;
+SET DEBUG_SYNC = 'RESET';
+SELECT * FROM t1 WHERE f1= bug27563();
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SELECT * FROM t1;
f1
0
1
-select * from t2;
-f2
-select release_lock("lock27563");
-release_lock("lock27563")
+SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION bug27563;
+CREATE TABLE t2 (f2 INT);
+CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+INSERT INTO t2 VALUES(0);
+SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
+INSERT INTO t2 VALUES(1);
+END|
+INSERT INTO t1 VALUES(2),(3);
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SELECT * FROM t1;
+f1
+0
1
-drop table t1, t2;
-drop function bug27563;
-drop procedure proc27563;
+SELECT * FROM t2;
+f2
+0
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1, t2;
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 ';
EXECUTE stmt;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+KILL QUERY @id;
+ERROR 70100: Query execution was interrupted
+SET DEBUG_SYNC = 'RESET';
#
# Bug#19723: kill of active connection yields different error code
# depending on platform.
#
-# Connection: con2.
-KILL CONNECTION_ID();
-# CR_SERVER_LOST, CR_SERVER_GONE_ERROR, depending on the timing
-# of close of the connection socket
+# Connection: con1.
+SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
+KILL @id;
+ERROR 70100: Query execution was interrupted
+SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
+# ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST,
+# depending on the timing of close of the connection socket
SELECT 1;
Got one of the listed errors
+SELECT 1;
+1
+1
+SELECT @id != CONNECTION_ID();
+@id != CONNECTION_ID()
+1
+SET DEBUG_SYNC = 'RESET';
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
# Check that DDL and DML statements waiting for metadata locks can
@@ -208,13 +243,11 @@ ERROR 70100: Query execution was interrupted
# Test for DML waiting for meta-data lock
# Switching to connection 'blocker'
unlock tables;
-drop table t2;
-create table t2 (k int);
lock tables t1 read;
# Switching to connection 'ddl'
-rename tables t1 to t3, t2 to t1;
+truncate table t1;
# Switching to connection 'dml'
-insert into t2 values (1);
+insert into t1 values (1);
# Switching to connection 'default'
kill query ID2;
# Switching to connection 'dml'
@@ -239,6 +272,7 @@ unlock tables;
# Switching to connection 'ddl'
# Cleanup.
# Switching to connection 'default'
-drop table t3;
drop table t1;
-set @@global.concurrent_insert= @old_concurrent_insert;
+drop table t2;
+SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION MY_KILL;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 1c59f41cfc0..c4c8216c14a 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -532,4 +532,20 @@ a
0
1
DROP TABLE t1;
+#
+# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
+#
+CREATE TABLE t1(f1 INT);
+SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
+LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
+DROP TABLE t1;
+#
+# Bug#11765141 - 58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
+# WHEN ERROR OCCURS
+#
+SELECT '1\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt';
+create table t1(a point);
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt' INTO TABLE t1;
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index 99e1f54e762..1a8ef2deefd 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -430,6 +430,8 @@ SELECT table_name, table_comment FROM information_schema.tables
WHERE table_schema= 'test' AND table_name= 't1';
table_name table_comment
t1 Lock wait timeout exceeded; try restarting transaction
+Warnings:
+Warning 1205 Lock wait timeout exceeded; try restarting transaction
# Connection default
UNLOCK TABLES;
# Connection con3
diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result
index 3682f0df26a..8fe94679e70 100644
--- a/mysql-test/r/lock_sync.result
+++ b/mysql-test/r/lock_sync.result
@@ -704,3 +704,72 @@ SET DEBUG_SYNC="now SIGNAL query";
# Connection default
DROP EVENT e2;
SET DEBUG_SYNC="RESET";
+#
+# Bug#55930 Assertion `thd->transaction.stmt.is_empty() ||
+# thd->in_sub_stmt || (thd->state..
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT) engine=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+# Connection con1
+SET SESSION lock_wait_timeout= 1;
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
+SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock';
+# Sending:
+INSERT INTO t1 VALUES (3);
+# Connection default
+SET DEBUG_SYNC= 'now WAIT_FOR thrlock';
+SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
+# Connection con1
+# Reaping: OPTIMIZE TABLE t1
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize error Lock wait timeout exceeded; try restarting transaction
+test.t1 optimize status Operation failed
+Warnings:
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
+# Connection con2
+# Reaping: INSERT INTO t1 VALUES (3)
+# Connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+#
+# Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
+#
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1(a INT);
+CREATE FUNCTION f1() RETURNS INTEGER RETURN 1;
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1;
+DROP FUNCTION f1;
+# Connection con1
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
+# Sending:
+SHOW CREATE VIEW v1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+# Sending:
+FLUSH TABLES;
+# Connection default
+# Waiting for FLUSH TABLES to be blocked.
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+# Connection con1
+# Reaping: SHOW CREATE VIEW v1
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`f1`() = 1) latin1 latin1_swedish_ci
+Warnings:
+Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+# Connection con2
+# Reaping: FLUSH TABLES
+# Connection default
+SET DEBUG_SYNC= 'RESET';
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 1666d5e0297..f64894c9f10 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -896,6 +896,16 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
+use mysql;
+drop table if exists renamed_general_log;
+drop table if exists renamed_slow_log;
+RENAME TABLE general_log TO renamed_general_log;
+ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
+RENAME TABLE slow_log TO renamed_slow_log;
+ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'slow_log'
+use test;
+flush tables with read lock;
+unlock tables;
SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result
index 850bdf5c2bd..5ed59eecc31 100644
--- a/mysql-test/r/log_tables_upgrade.result
+++ b/mysql-test/r/log_tables_upgrade.result
@@ -32,6 +32,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.renamed_general_log OK
mysql.servers OK
mysql.tables_priv OK
diff --git a/mysql-test/r/lowercase_fs_off.result b/mysql-test/r/lowercase_fs_off.result
index 30f835a8ea3..c3284b225dd 100644
--- a/mysql-test/r/lowercase_fs_off.result
+++ b/mysql-test/r/lowercase_fs_off.result
@@ -55,3 +55,11 @@ DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;
+#
+# Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X
+#
+CREATE TABLE t1(a INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
+RENAME TABLE t1 TO T1;
+ALTER TABLE T1 RENAME t1;
+DROP TABLE t1;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index caee7a7662b..abd16641b56 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -175,6 +175,35 @@ TABLE_SCHEMA TABLE_NAME
mysqltest_lc2 myUC
use test;
drop database mysqltest_LC2;
+#
+# Bug #11758687: 50924: object names not resolved correctly
+# on lctn2 systems
+#
+CREATE DATABASE BUP_XPFM_COMPAT_DB2;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+SELECT trigger_schema, trigger_name, event_object_table FROM
+INFORMATION_SCHEMA.TRIGGERS
+WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2'
+ ORDER BY trigger_schema, trigger_name;
+trigger_schema trigger_name event_object_table
+BUP_XPFM_COMPAT_DB2 trigger1 table1
+BUP_XPFM_COMPAT_DB2 TRIGGER2 TABLE2
+BUP_XPFM_COMPAT_DB2 TrigGer3 table3
+DROP DATABASE BUP_XPFM_COMPAT_DB2;
# End of 5.1 tests
#
# Test for bug #44738 "fill_schema_table_from_frm() opens tables without
diff --git a/mysql-test/r/lowercase_table4.result b/mysql-test/r/lowercase_table4.result
new file mode 100755
index 00000000000..f896b9008e3
--- /dev/null
+++ b/mysql-test/r/lowercase_table4.result
@@ -0,0 +1,115 @@
+#
+# Bug#46941 crash with lower_case_table_names=2 and
+# foreign data dictionary confusion
+#
+CREATE DATABASE XY;
+USE XY;
+DROP DATABASE XY;
+USE TEST;
+#
+# Bug55222 Mysqldump table names case bug in REFERENCES clause
+# InnoDB did not handle lower_case_table_names=2 for
+# foreign_table_names and referenced_table_names.
+#
+SHOW VARIABLES LIKE 'lower_case_table_names';
+Variable_name Value
+lower_case_table_names 2
+DROP TABLE IF EXISTS `Table2`;
+DROP TABLE IF EXISTS `Table1`;
+CREATE TABLE `Table1`(c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE `Table2`(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
+ALTER TABLE `Table2` ADD CONSTRAINT fk1 FOREIGN KEY(c2) REFERENCES `Table1`(c1);
+SHOW CREATE TABLE `Table2`;
+Table Table2
+Create Table CREATE TABLE `Table2` (
+ `c1` int(11) NOT NULL,
+ `c2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `fk1` (`c2`),
+ CONSTRAINT `fk1` FOREIGN KEY (`c2`) REFERENCES `Table1` (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA test
+CONSTRAINT_NAME fk1
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA test
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE RESTRICT
+DELETE_RULE RESTRICT
+TABLE_NAME Table2
+REFERENCED_TABLE_NAME Table1
+DROP TABLE `Table2`;
+DROP TABLE `Table1`;
+DROP TABLE IF EXISTS Product_Order;
+DROP TABLE IF EXISTS Product;
+DROP TABLE IF EXISTS Customer;
+CREATE TABLE Product (Category INT NOT NULL, Id INT NOT NULL,
+Price DECIMAL, PRIMARY KEY(Category, Id)) ENGINE=InnoDB;
+CREATE TABLE Customer (Id INT NOT NULL, PRIMARY KEY (Id)) ENGINE=InnoDB;
+CREATE TABLE Product_Order (No INT NOT NULL AUTO_INCREMENT,
+Product_Category INT NOT NULL,
+Product_Id INT NOT NULL,
+Customer_Id INT NOT NULL,
+PRIMARY KEY(No),
+INDEX (Product_Category, Product_Id),
+FOREIGN KEY (Product_Category, Product_Id)
+REFERENCES Product(Category, Id) ON UPDATE CASCADE ON DELETE RESTRICT,
+INDEX (Customer_Id),
+FOREIGN KEY (Customer_Id)
+REFERENCES Customer(Id)
+) ENGINE=INNODB;
+SHOW CREATE TABLE Product_Order;
+Table Product_Order
+Create Table CREATE TABLE `Product_Order` (
+ `No` int(11) NOT NULL AUTO_INCREMENT,
+ `Product_Category` int(11) NOT NULL,
+ `Product_Id` int(11) NOT NULL,
+ `Customer_Id` int(11) NOT NULL,
+ PRIMARY KEY (`No`),
+ KEY `Product_Category` (`Product_Category`,`Product_Id`),
+ KEY `Customer_Id` (`Customer_Id`),
+ CONSTRAINT `product_order_ibfk_1` FOREIGN KEY (`Product_Category`, `Product_Id`) REFERENCES `Product` (`Category`, `Id`) ON UPDATE CASCADE,
+ CONSTRAINT `product_order_ibfk_2` FOREIGN KEY (`Customer_Id`) REFERENCES `Customer` (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE Product;
+Table Product
+Create Table CREATE TABLE `Product` (
+ `Category` int(11) NOT NULL,
+ `Id` int(11) NOT NULL,
+ `Price` decimal(10,0) DEFAULT NULL,
+ PRIMARY KEY (`Category`,`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE Customer;
+Table Customer
+Create Table CREATE TABLE `Customer` (
+ `Id` int(11) NOT NULL,
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
+CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA test
+CONSTRAINT_NAME product_order_ibfk_1
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA test
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE CASCADE
+DELETE_RULE RESTRICT
+TABLE_NAME Product_Order
+REFERENCED_TABLE_NAME Product
+CONSTRAINT_CATALOG def
+CONSTRAINT_SCHEMA test
+CONSTRAINT_NAME product_order_ibfk_2
+UNIQUE_CONSTRAINT_CATALOG def
+UNIQUE_CONSTRAINT_SCHEMA test
+UNIQUE_CONSTRAINT_NAME PRIMARY
+MATCH_OPTION NONE
+UPDATE_RULE RESTRICT
+DELETE_RULE RESTRICT
+TABLE_NAME Product_Order
+REFERENCED_TABLE_NAME Customer
+DROP TABLE Product_Order;
+DROP TABLE Product;
+DROP TABLE Customer;
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index d484ab77701..b2e71faf741 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -2322,6 +2322,8 @@ select table_name, table_type, auto_increment, table_comment
from information_schema.tables where table_schema='test' and table_name='t2';
table_name table_type auto_increment table_comment
t2 BASE TABLE NULL Table 'test'.'t2' was skipped since its definition is being modified by concurrent DDL statement
+Warnings:
+Warning 1684 Table 'test'.'t2' was skipped since its definition is being modified by concurrent DDL statement
# Switching to connection 'default'.
unlock tables;
# Switching to connection 'con46044'.
@@ -2471,7 +2473,7 @@ CREATE PROCEDURE p1() SELECT 1;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let CREATE PROCEDURE continue
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
# Connection 1
# Connection 2
@@ -2486,10 +2488,17 @@ DROP PROCEDURE p1;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL grlwait';
+SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
# Connection 1
+# Once FLUSH TABLES WITH READ LOCK starts waiting
+# DROP PROCEDURE will be waked up and will drop
+# procedure. Global read lock will be granted after
+# this statement ends.
+#
+# Reaping DROP PROCEDURE.
# Connection 2
+# Reaping FTWRL.
UNLOCK TABLES;
# Connection 1
SET DEBUG_SYNC= 'RESET';
@@ -2632,7 +2641,8 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
# Connection: con1
-SET debug_sync='lock_table_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
+LOCK TABLES t1 WRITE;
+SET debug_sync='upgrade_lock_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
TRUNCATE TABLE t1;
# Connection: default
SET debug_sync='now WAIT_FOR parked_truncate';
@@ -2647,10 +2657,11 @@ FLUSH TABLES t1;
# Connection: default
SET debug_sync='now WAIT_FOR parked_flush';
SET debug_sync='now SIGNAL go_truncate';
-# Connection: con1
-# Reaping...
-# Connection: default
+# Ensure that truncate waits for a exclusive lock
SET debug_sync= 'now SIGNAL go_show';
+# Connection: con1 (TRUNCATE)
+# Reaping...
+UNLOCK TABLES;
# Connection: con2 (SHOW FIELDS FROM t1)
# Reaping...
Field Type Null Key Default Extra
@@ -2913,3 +2924,41 @@ UNLOCK TABLES;
# Connection default
UNLOCK TABLES;
DROP DATABASE db1;
+#
+# Bug#56292 Deadlock with ALTER TABLE and MERGE tables
+#
+DROP TABLE IF EXISTS t1, t2, m1;
+CREATE TABLE t1(a INT) engine=MyISAM;
+CREATE TABLE t2(a INT) engine=MyISAM;
+CREATE TABLE m1(a INT) engine=MERGE UNION=(t1, t2);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (3), (4);
+# Connection con1
+SET DEBUG_SYNC= 'mdl_upgrade_shared_lock_to_exclusive SIGNAL upgrade WAIT_FOR continue';
+# Sending:
+ALTER TABLE m1 engine=MERGE UNION=(t2, t1);
+# Connection con2
+# Waiting for ALTER TABLE to try lock upgrade
+SET DEBUG_SYNC= 'now WAIT_FOR upgrade';
+# Sending:
+DELETE FROM t2 WHERE a = 3;
+# Connection default
+# Check that DELETE is waiting on a metadata lock and not a table lock.
+# Now that DELETE blocks on a metadata lock, we should be able to do
+# SELECT * FROM m1 here. SELECT used to be blocked by a DELETE table
+# lock request.
+SELECT * FROM m1;
+a
+1
+2
+3
+4
+# Resuming ALTER TABLE
+SET DEBUG_SYNC= 'now SIGNAL continue';
+# Connection con1
+# Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1)
+# Connection con2
+# Reaping: DELETE FROM t2 WHERE a = 3
+# Connection default
+DROP TABLE m1, t1, t2;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index b6ebf5c8c9e..3219f81b125 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -2080,6 +2080,8 @@ SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE
TABLE_SCHEMA = 'test' and TABLE_NAME='tm1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
def test tm1 BASE TABLE NULL NULL NULL # # # # # # # # # # NULL # # Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+Warnings:
+Warning 1168 Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE tm1;
CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
@@ -2354,6 +2356,48 @@ t2 WHERE b SOUNDS LIKE e AND d = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t2, t1;
+#
+# Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
+#
+DROP TABLE IF EXISTS m1, t1;
+CREATE TABLE t1 (c1 INT) ENGINE=MYISAM;
+CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST;
+LOCK TABLE m1 READ;
+REPAIR TABLE m1 USE_FRM;
+Table Op Msg_type Msg_text
+test.m1 repair Error Table 'm1' was locked with a READ lock and can't be updated
+test.m1 repair status Operation failed
+UNLOCK TABLES;
+REPAIR TABLE m1 USE_FRM;
+Table Op Msg_type Msg_text
+test.m1 repair note The storage engine for the table doesn't support repair
+DROP TABLE m1,t1;
+CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
+REPAIR TABLE m1 USE_FRM;
+Table Op Msg_type Msg_text
+test.m1 repair Warning Can't open table
+test.m1 repair error Corrupt
+CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM;
+REPAIR TABLE m1 USE_FRM;
+Table Op Msg_type Msg_text
+test.m1 repair note The storage engine for the table doesn't support repair
+REPAIR TABLE m1;
+Table Op Msg_type Msg_text
+test.m1 repair note The storage engine for the table doesn't support repair
+DROP TABLE m1, t1;
+CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
+REPAIR TABLE m1 USE_FRM;
+Table Op Msg_type Msg_text
+test.m1 repair Error Table 'test.m1' doesn't exist
+test.m1 repair error Corrupt
+CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM;
+REPAIR TABLE m1 USE_FRM;
+Table Op Msg_type Msg_text
+m1 repair error Cannot repair temporary table from .frm file
+REPAIR TABLE m1;
+Table Op Msg_type Msg_text
+test.m1 repair note The storage engine for the table doesn't support repair
+DROP TABLE m1, t1;
End of 5.1 tests
#
# An additional test case for Bug#27430 Crash in subquery code
@@ -2673,7 +2717,7 @@ OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize Error Table 'test.t_not_exists' doesn't exist
test.t1 optimize Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
-test.t1 optimize note The storage engine for the table doesn't support optimize
+test.t1 optimize error Corrupt
DROP TABLE t1;
#
# Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
@@ -3440,7 +3484,7 @@ ALTER TABLE m1 ADD INDEX (c1);
UNLOCK TABLES;
DROP TABLE m1, t1;
#
-# If children are to be altered, they need an explicit lock.
+# Locking the merge table won't implicitly lock children.
#
CREATE TABLE t1 (c1 INT);
CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
@@ -3572,4 +3616,60 @@ ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1
drop view v1;
drop temporary table tmp;
drop table t1, t2, t3, m1, m2;
+#
+# Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for
+# REPAIR of merge table
+#
+DROP TABLE IF EXISTS t1, t2, t_not_exists;
+CREATE TABLE t1(a INT);
+ALTER TABLE t1 engine= MERGE UNION (t_not_exists);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze Error Table 'test.t_not_exists' doesn't exist
+test.t1 analyze Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.t1 analyze error Corrupt
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Table 'test.t_not_exists' doesn't exist
+test.t1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.t1 check error Corrupt
+CHECKSUM TABLE t1;
+Table Checksum
+test.t1 NULL
+Warnings:
+Error 1146 Table 'test.t_not_exists' doesn't exist
+Error 1168 Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize Error Table 'test.t_not_exists' doesn't exist
+test.t1 optimize Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.t1 optimize error Corrupt
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair Error Table 'test.t_not_exists' doesn't exist
+test.t1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.t1 repair error Corrupt
+REPAIR TABLE t1 USE_FRM;
+Table Op Msg_type Msg_text
+test.t1 repair Warning Can't open table
+test.t1 repair error Corrupt
+DROP TABLE t1;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT) engine= MERGE UNION (t1);
+REPAIR TABLE t2 USE_FRM;
+Table Op Msg_type Msg_text
+test.t2 repair note The storage engine for the table doesn't support repair
+DROP TABLE t1, t2;
+#
+# Bug#57002 Assert in upgrade_shared_lock_to_exclusive()
+# for ALTER TABLE + MERGE tables
+#
+DROP TABLE IF EXISTS t1, m1;
+CREATE TABLE t1(a INT) engine=myisam;
+CREATE TABLE m1(a INT) engine=merge UNION(t1);
+LOCK TABLES t1 READ, m1 WRITE;
+ALTER TABLE t1 engine=myisam;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+DROP TABLE m1, t1;
End of 6.0 tests
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index 480cec792c0..3418348854f 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -126,7 +126,7 @@ renamed
1
select * from v3 where renamed=1 group by renamed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def v3 v3 renamed renamed 8 11 0 Y 32896 0 63
+def v3 v3 renamed renamed 8 12 0 Y 32896 0 63
renamed
drop table t1;
drop view v1,v2,v3;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 07a92e2abf0..c6ee170eef7 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -669,4 +669,68 @@ Error 1242 Subquery returns more than 1 row
Error 1242 Subquery returns more than 1 row
DROP TABLE t1, t2, t3;
SET SESSION sql_safe_updates = DEFAULT;
-end of tests
+#
+# Bug#52157 various crashes and assertions with multi-table update, stored function
+#
+CREATE FUNCTION f1 () RETURNS BLOB RETURN 1;
+CREATE TABLE t1 (f1 DATE);
+INSERT INTO t1 VALUES('2001-01-01');
+UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1;
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '1'
+DROP FUNCTION f1;
+DROP TABLE t1;
+#
+# BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
+# table is updated twice
+#
+CREATE TABLE t1(
+pk INT,
+a INT,
+PRIMARY KEY (pk)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0,0);
+UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
+
+# Should be (1,2)
+SELECT * FROM t1;
+pk a
+1 2
+DROP TABLE t1;
+#
+# BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
+# UPDATED TWICE
+#
+CREATE TABLE t1 (
+col_int_key int,
+pk int,
+col_int int,
+key(col_int_key),
+primary key (pk)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,2,3);
+
+CREATE TABLE t2 (
+col_int_key int,
+pk_1 int,
+pk_2 int,
+col_int int,
+key(col_int_key),
+primary key (pk_1,pk_2)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2,3,4);
+
+UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
+
+SELECT * FROM t1;
+col_int_key pk col_int
+1 7 3
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
+
+SELECT * FROM t2;
+col_int_key pk_1 pk_2 col_int
+1 7 11 4
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/multi_update_innodb.result b/mysql-test/r/multi_update_innodb.result
new file mode 100644
index 00000000000..643287c3a93
--- /dev/null
+++ b/mysql-test/r/multi_update_innodb.result
@@ -0,0 +1,69 @@
+#
+# BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
+# table is updated twice
+#
+CREATE TABLE t1(
+pk INT,
+a INT,
+b INT,
+PRIMARY KEY (pk)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0,0,0);
+UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+SELECT * FROM t1;
+pk a b
+0 0 0
+CREATE VIEW v1 AS SELECT * FROM t1;
+UPDATE v1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+SELECT * FROM t1;
+pk a b
+0 0 0
+UPDATE t1 AS A, t1 AS B SET A.a = 1, B.b = 2;
+# Should be (0,1,2)
+SELECT * FROM t1;
+pk a b
+0 1 2
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
+# UPDATED TWICE
+#
+CREATE TABLE t1 (
+col_int_key int,
+pk int,
+col_int int,
+key(col_int_key),
+primary key (pk)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2,3);
+
+CREATE TABLE t2 (
+col_int_key int,
+pk_1 int,
+pk_2 int,
+col_int int,
+key(col_int_key),
+primary key (pk_1,pk_2)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,2,3,4);
+
+UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+SELECT * FROM t1;
+col_int_key pk col_int
+1 2 3
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+SELECT * FROM t2;
+col_int_key pk_1 pk_2 col_int
+1 2 3 4
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result
index dd14c31f32e..91700701139 100644
--- a/mysql-test/r/myisampack.result
+++ b/mysql-test/r/myisampack.result
@@ -46,14 +46,12 @@ insert into t1 select * from t1;
flush tables;
optimize table t1;
Table Op Msg_type Msg_text
-test.t1 optimize error Table 'test.t1' is read only
-Warnings:
-Error 1036 Table 't1' is read only
+test.t1 optimize Error Table 't1' is read only
+test.t1 optimize status Operation failed
repair table t1;
Table Op Msg_type Msg_text
-test.t1 repair error Table 'test.t1' is read only
-Warnings:
-Error 1036 Table 't1' is read only
+test.t1 repair Error Table 't1' is read only
+test.t1 repair status Operation failed
drop table t1;
#
# BUG#41541 - Valgrind warnings on packed MyISAM table
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 3c53faff526..9923ba03b3d 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -433,4 +433,73 @@ Bug #47147: mysql client option --skip-column-names does not apply to vertical o
*************************** 1. row ***************************
1
+#
+# Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE
+# commands.
+#
+CREATE DATABASE connected_db;
+USE connected_db;
+SHOW TABLES;
+Tables_in_connected_db
+table_in_connected_db
+DROP DATABASE connected_db;
+
+#
+# Testing --one-database option
+#
+CREATE DATABASE connected_db;
+SHOW TABLES IN connected_db;
+Tables_in_connected_db
+t1
+SHOW TABLES IN test;
+Tables_in_test
+t1
+USE test;
+DROP TABLE t1;
+DROP DATABASE connected_db;
+
+SHOW TABLES IN test;
+Tables_in_test
+SHOW TABLES IN test1;
+Tables_in_test1
+DROP DATABASE test1;
+
+#
+# Checking --one-database option followed by the execution of
+# connect command.
+#
+CREATE DATABASE connected_db;
+SHOW TABLES IN connected_db;
+Tables_in_connected_db
+t1
+t2
+SHOW TABLES IN test;
+Tables_in_test
+t1
+t2
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP DATABASE connected_db;
+
+#
+# Checking --one-database option with no database specified
+# at command-line.
+#
+SHOW TABLES IN test;
+Tables_in_test
+
+#
+# Checking --one-database option with non_existent_db
+# specified with USE command
+#
+CREATE DATABASE connected_db;
+SHOW TABLES IN connected_db;
+Tables_in_connected_db
+table_in_connected_db
+
+SHOW TABLES IN connected_db;
+Tables_in_connected_db
+table_in_connected_db
+DROP DATABASE connected_db;
+
End of tests
diff --git a/mysql-test/r/mysql_embedded.result b/mysql-test/r/mysql_embedded.result
new file mode 100644
index 00000000000..3ba79a01e44
--- /dev/null
+++ b/mysql-test/r/mysql_embedded.result
@@ -0,0 +1,5 @@
+#
+# Bug#12561297 : LIBMYSQLD/EXAMPLE/MYSQL_EMBEDDED IS ABORTING.
+#
+1
+1
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 7737dab49b2..cc4c7a1dad9 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -20,6 +20,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -56,6 +57,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -92,6 +94,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -131,6 +134,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -173,6 +177,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -218,6 +223,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result
index 23ad09dbd9c..a08e7c115cc 100644
--- a/mysql-test/r/mysql_upgrade_ssl.result
+++ b/mysql-test/r/mysql_upgrade_ssl.result
@@ -22,6 +22,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
diff --git a/mysql-test/r/mysqladmin.result b/mysql-test/r/mysqladmin.result
index 57927f8aa67..8a9b009946b 100644
--- a/mysql-test/r/mysqladmin.result
+++ b/mysql-test/r/mysqladmin.result
@@ -2,3 +2,18 @@ mysqld is alive
mysqladmin: unknown variable 'database=db1'
Warning: mysqladmin: unknown variable 'loose-database=db2'
mysqld is alive
+#
+# Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
+#
+# Executing mysqladmin with --sleep=1 and --count=2.
+# Done.
+# Displaying the output :
+mysqld is alive
+mysqld is alive
+#
+# BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file
+# with no .cnf or .ini extension.
+#
+# Creating an empty file 'cnf_file'
+# Using --defaults-extra-file option with 'cnf_file'.
+mysqld is alive
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 51fad679909..5a47b6700c0 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -879,3 +879,39 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
End of 5.0 tests
End of 5.1 tests
+# Expect deprecation warning.
+WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead.
+# Expect deprecation warning again.
+WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead.
+RESET MASTER;
+CREATE DATABASE test1;
+USE test1;
+CREATE TABLE t1(id int);
+DROP DATABASE test1;
+CREATE DATABASE test1;
+USE test1;
+CREATE TABLE t1(id int);
+DROP TABLE t1;
+DROP DATABASE test1;
+FLUSH LOGS;
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Query # # CREATE DATABASE test1
+master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int)
+master-bin.000002 # Query # # DROP DATABASE test1
+master-bin.000002 # Query # # CREATE DATABASE test1
+master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int)
+master-bin.000002 # Query # # use `test1`; DROP TABLE `t1` /* generated by server */
+master-bin.000002 # Query # # DROP DATABASE test1
+RESET MASTER;
+USE test;
+CREATE TABLE t1 (a INT);
+SET GLOBAL SERVER_ID = 2;
+DROP TABLE t1;
+FLUSH LOGS;
+SHOW TABLES IN test;
+Tables_in_test
+t1
+SHOW TABLES IN test;
+Tables_in_test
+SET GLOBAL SERVER_ID = 1;
diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result
index c5e1e2f8ca1..72d49c16cc8 100644
--- a/mysql-test/r/mysqlbinlog_base64.result
+++ b/mysql-test/r/mysqlbinlog_base64.result
@@ -109,3 +109,13 @@ count(*)
35840
drop table t1;
drop table t2;
+RESET MASTER;
+USE test;
+SET @old_binlog_format= @@binlog_format;
+SET SESSION binlog_format=ROW;
+CREATE TABLE t1(c1 INT);
+INSERT INTO t1 VALUES (1);
+FLUSH LOGS;
+DROP TABLE t1;
+SET SESSION binlog_format= @old_binlog_format;
+RESET MASTER;
diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result
index 46fa0dc79cd..0bdbfdcee3a 100644
--- a/mysql-test/r/mysqlbinlog_row_big.result
+++ b/mysql-test/r/mysqlbinlog_row_big.result
@@ -36,8 +36,8 @@ c1 LONGTEXT
#
# Insert some big rows.
#
-256MB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
+64MB
+INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304));
affected rows: 1
32MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
@@ -53,7 +53,7 @@ affected rows: 1
# Do not display the column value itself, just its length.
#
SELECT LENGTH(c1) FROM t1;
-LENGTH(c1) 268435456
+LENGTH(c1) 67108864
LENGTH(c1) 33554432
LENGTH(c1) 4194304
LENGTH(c1) 524288
@@ -69,7 +69,7 @@ info: Rows matched: 4 Changed: 4 Warnings: 0
# Do not display the column value itself, just its length.
#
SELECT LENGTH(c1) FROM t1;
-LENGTH(c1) 536870912
+LENGTH(c1) 134217728
LENGTH(c1) 1048576
LENGTH(c1) 67108864
LENGTH(c1) 8388608
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 6217f4e48ee..f59942d609c 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -16,6 +16,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -24,6 +25,8 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
+mtr.global_suppressions Table is already up to date
+mtr.test_suppressions Table is already up to date
mysql.columns_priv OK
mysql.db OK
mysql.event OK
@@ -37,6 +40,7 @@ mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
+mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
@@ -45,20 +49,66 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
-create table t1 (a int);
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.servers OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+mysql.columns_priv Table is already up to date
+mysql.db Table is already up to date
+mysql.event Table is already up to date
+mysql.func Table is already up to date
+mysql.help_category Table is already up to date
+mysql.help_keyword Table is already up to date
+mysql.help_relation Table is already up to date
+mysql.help_topic Table is already up to date
+mysql.host Table is already up to date
+mysql.ndb_binlog_index Table is already up to date
+mysql.plugin Table is already up to date
+mysql.proc Table is already up to date
+mysql.procs_priv Table is already up to date
+mysql.proxies_priv Table is already up to date
+mysql.servers Table is already up to date
+mysql.tables_priv Table is already up to date
+mysql.time_zone Table is already up to date
+mysql.time_zone_leap_second Table is already up to date
+mysql.time_zone_name Table is already up to date
+mysql.time_zone_transition Table is already up to date
+mysql.time_zone_transition_type Table is already up to date
+mysql.user Table is already up to date
+create table t1 (a int) engine=myisam;
create view v1 as select * from t1;
test.t1 OK
+test.t1 Table is already up to date
test.t1 OK
+test.t1 Table is already up to date
drop view v1;
drop table t1;
-create table `t``1`(a int);
-create table `t 1`(a int);
+create table `t``1`(a int) engine=myisam;
+create table `t 1`(a int) engine=myisam;
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 table t_bug25347 (a int) engine=myisam;
create view v_bug25347 as select * from t_bug25347;
insert into t_bug25347 values (1),(2),(3);
flush tables;
@@ -98,15 +148,15 @@ Table Op Msg_type Msg_text
test.v1 check status OK
information_schema.routines check note The storage engine for the table doesn't support check
drop view v1;
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT);
+CREATE TABLE t1(a INT) engine=myisam;
+CREATE TABLE t2(a INT) engine=myisam;
test.t1
Error : Incorrect information in file: './test/t1.frm'
error : Corrupt
test.t2 OK
DROP TABLE t1, t2;
End of 5.0 tests
-create table t1(a int);
+create table t1(a int) engine=myisam;
create view v1 as select * from t1;
show tables;
Tables_in_test
@@ -117,6 +167,7 @@ Tables_in_test
t1
#mysql50#v-1
v1
+test.t1 OK
show tables;
Tables_in_test
t1
@@ -125,7 +176,7 @@ v-1
drop view v1, `v-1`;
drop table t1;
SET NAMES utf8;
-CREATE TABLE `#mysql50#@` (a INT);
+CREATE TABLE `#mysql50#@` (a INT) engine=myisam;
SHOW TABLES;
Tables_in_test
#mysql50#@
@@ -136,7 +187,7 @@ SHOW TABLES;
Tables_in_test
@
DROP TABLE `@`;
-CREATE TABLE `Ñ` (a INT);
+CREATE TABLE `Ñ` (a INT) engine=myisam;
SET NAMES DEFAULT;
mysqlcheck --default-character-set="latin1" --databases test
test.?
@@ -149,8 +200,8 @@ DROP TABLE `Ñ`;
SET NAMES DEFAULT;
CREATE DATABASE `#mysql50#a@b`;
USE `#mysql50#a@b`;
-CREATE TABLE `#mysql50#c@d` (a INT);
-CREATE TABLE t1 (a INT);
+CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam;
+CREATE TABLE t1 (a INT) engine=myisam;
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
@@ -179,14 +230,81 @@ USE test;
# Bug #31821: --all-in-1 and --fix-table-names don't work together
#
drop table if exists `#mysql50#t1-1`;
-create table `#mysql50#t1-1` (a int);
+create table `#mysql50#t1-1` (a int) engine=myisam;
show tables like 't1-1';
Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
-create table `#mysql50#t1-1` (a int);
+create table `#mysql50#t1-1` (a int) engine=myisam;
show tables like 't1-1';
Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
End of 5.1 tests
+#
+# Bug #35269: mysqlcheck behaves different depending on order of parameters
+#
+#
+# Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR
+# ENGINES NOT SUPPORTING NATIVE
+#
+DROP TABLE IF EXISTS bug47205;
+#
+# Test 1: Check that ALTER TABLE ... rebuilds the table
+CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
+DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
+INSERT INTO bug47205 VALUES ("foobar");
+FLUSH TABLE bug47205;
+# Replace the FRM with a 5.0 FRM that will require upgrade
+# Should indicate that ALTER TABLE ... FORCE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
+# ALTER TABLE ... FORCE should rebuild the table
+# and therefore output "affected rows: 1"
+ALTER TABLE bug47205 FORCE;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+# Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.bug47205 check status OK
+DROP TABLE bug47205;
+#
+# Test 2: InnoDB - REPAIR not supported
+CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
+DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
+FLUSH TABLE bug47205;
+# Replace the FRM with a 5.0 FRM that will require upgrade
+# Should indicate that ALTER TABLE .. FORCE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
+# Running mysqlcheck to check and upgrade
+test.bug47205
+error : Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
+
+Repairing tables
+# Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.bug47205 check status OK
+DROP TABLE bug47205;
+#
+# Test 3: MyISAM - REPAIR supported
+# Use an old FRM that will require upgrade
+# Should indicate that REPAIR TABLE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.bug47205 check error Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it!
+# Running mysqlcheck to check and upgrade
+test.bug47205
+error : Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it!
+
+Repairing tables
+test.bug47205 OK
+# Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+Table Op Msg_type Msg_text
+test.bug47205 check status OK
+DROP TABLE bug47205;
diff --git a/mysql-test/r/mysqld--defaults-file.result b/mysql-test/r/mysqld--defaults-file.result
new file mode 100644
index 00000000000..5fd5ca8d95a
--- /dev/null
+++ b/mysql-test/r/mysqld--defaults-file.result
@@ -0,0 +1,12 @@
+Could not open required defaults file: /path/with/no/extension
+Fatal error in defaults handling. Program aborted
+Could not open required defaults file: /path/with.ext
+Fatal error in defaults handling. Program aborted
+Could not open required defaults file: MYSQL_TEST_DIR/relative/path/with.ext
+Fatal error in defaults handling. Program aborted
+Could not open required defaults file: MYSQL_TEST_DIR/relative/path/without/extension
+Fatal error in defaults handling. Program aborted
+Could not open required defaults file: MYSQL_TEST_DIR/with.ext
+Fatal error in defaults handling. Program aborted
+Could not open required defaults file: MYSQL_TEST_DIR/no_extension
+Fatal error in defaults handling. Program aborted
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 8cd8dc2b0dd..631829c30de 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -19,6 +19,8 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment != 1
+ --autocommit Set default value for autocommit (0 or 1)
+ (Defaults to on; use --skip-autocommit to disable.)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
@@ -31,10 +33,10 @@ The following options may be given as the first argument:
file (Solves most 'table full' errors)
--bind-address=name IP address to bind to.
--binlog-cache-size=#
- The size of the cache to hold the SQL statements for the
- binary log during a transaction. If you often use big,
- multi-statement transactions you can increase this to get
- more performance
+ The size of the transactional cache for updates to
+ transactional engines for the binary log. If you often
+ use transactions containing many statements, you can
+ increase this to get more performance
--binlog-direct-non-transactional-updates
Causes updates to non-transactional engines using
statement format to be written directly to binary log.
@@ -65,6 +67,11 @@ The following options may be given as the first argument:
The maximum size of a row-based binary log event in
bytes. Rows will be grouped into events smaller than this
size if possible. The value has to be a multiple of 256.
+ --binlog-stmt-cache-size=#
+ The size of the statement cache for updates to
+ non-transactional engines for the binary log. If you
+ often use statements updating a great number of rows, you
+ can increase this to get more performance
--bootstrap Used by mysql installation scripts.
--bulk-insert-buffer-size=#
Size of tree cache used in bulk insert optimisation. Note
@@ -311,14 +318,15 @@ The following options may be given as the first argument:
--max-allowed-packet=#
Max packet length to send to or receive from the server
--max-binlog-cache-size=#
- Can be used to restrict the total size used to cache a
- multi-transaction query
+ Sets the total size of the transactional cache
--max-binlog-dump-events=#
Option used by mysql-test for debugging and testing of
replication.
--max-binlog-size=# Binary log will be rotated automatically when the size
exceeds this value. Will also apply to relay logs if
max_relay_log_size is 0
+ --max-binlog-stmt-cache-size=#
+ Sets the total size of the statement cache
--max-connect-errors=#
If there is more than this number of interrupted
connections from a host this host will be blocked from
@@ -335,6 +343,10 @@ The following options may be given as the first argument:
max_join_size records return an error
--max-length-for-sort-data=#
Max number of bytes in sorted records
+ --max-long-data-size=#
+ The maximum BLOB length to send to server from
+ mysql_send_long_data API. Deprecated option; use
+ max_allowed_packet instead.
--max-prepared-stmt-count=#
Maximum number of prepared statements in the server
--max-relay-log-size=#
@@ -775,6 +787,7 @@ abort-slave-event-count 0
allow-suspicious-udfs FALSE
auto-increment-increment 1
auto-increment-offset 1
+autocommit TRUE
automatic-sp-privileges TRUE
back-log 50
big-tables FALSE
@@ -783,6 +796,7 @@ binlog-cache-size 32768
binlog-direct-non-transactional-updates FALSE
binlog-format STATEMENT
binlog-row-event-max-size 1024
+binlog-stmt-cache-size 32768
bulk-insert-buffer-size 8388608
character-set-client-handshake TRUE
character-set-filesystem binary
@@ -873,6 +887,7 @@ max-allowed-packet 1048576
max-binlog-cache-size 18446744073709547520
max-binlog-dump-events 0
max-binlog-size 1073741824
+max-binlog-stmt-cache-size 18446744073709547520
max-connect-errors 10
max-connections 151
max-delayed-threads 20
@@ -880,6 +895,7 @@ max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
max-length-for-sort-data 1024
+max-long-data-size 1048576
max-prepared-stmt-count 16382
max-relay-log-size 0
max-seeks-for-key 18446744073709551615
@@ -977,7 +993,6 @@ slave-transaction-retries 10
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
-socket /tmp/mysql.sock
sort-buffer-size 2097152
sporadic-binlog-dump-fail FALSE
sql-mode
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index e1098b71e25..361d30620f7 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -19,6 +19,8 @@ The following options may be given as the first argument:
--auto-increment-offset[=#]
Offset added to Auto-increment columns. Used when
auto-increment-increment != 1
+ --autocommit Set default value for autocommit (0 or 1)
+ (Defaults to on; use --skip-autocommit to disable.)
--automatic-sp-privileges
Creating and dropping stored procedures alters ACLs
(Defaults to on; use --skip-automatic-sp-privileges to disable.)
@@ -31,10 +33,10 @@ The following options may be given as the first argument:
file (Solves most 'table full' errors)
--bind-address=name IP address to bind to.
--binlog-cache-size=#
- The size of the cache to hold the SQL statements for the
- binary log during a transaction. If you often use big,
- multi-statement transactions you can increase this to get
- more performance
+ The size of the transactional cache for updates to
+ transactional engines for the binary log. If you often
+ use transactions containing many statements, you can
+ increase this to get more performance
--binlog-direct-non-transactional-updates
Causes updates to non-transactional engines using
statement format to be written directly to binary log.
@@ -65,6 +67,11 @@ The following options may be given as the first argument:
The maximum size of a row-based binary log event in
bytes. Rows will be grouped into events smaller than this
size if possible. The value has to be a multiple of 256.
+ --binlog-stmt-cache-size=#
+ The size of the statement cache for updates to
+ non-transactional engines for the binary log. If you
+ often use statements updating a great number of rows, you
+ can increase this to get more performance
--bootstrap Used by mysql installation scripts.
--bulk-insert-buffer-size=#
Size of tree cache used in bulk insert optimisation. Note
@@ -276,14 +283,15 @@ The following options may be given as the first argument:
--max-allowed-packet=#
Max packet length to send to or receive from the server
--max-binlog-cache-size=#
- Can be used to restrict the total size used to cache a
- multi-transaction query
+ Sets the total size of the transactional cache
--max-binlog-dump-events=#
Option used by mysql-test for debugging and testing of
replication.
--max-binlog-size=# Binary log will be rotated automatically when the size
exceeds this value. Will also apply to relay logs if
max_relay_log_size is 0
+ --max-binlog-stmt-cache-size=#
+ Sets the total size of the statement cache
--max-connect-errors=#
If there is more than this number of interrupted
connections from a host this host will be blocked from
@@ -300,6 +308,10 @@ The following options may be given as the first argument:
max_join_size records return an error
--max-length-for-sort-data=#
Max number of bytes in sorted records
+ --max-long-data-size=#
+ The maximum BLOB length to send to server from
+ mysql_send_long_data API. Deprecated option; use
+ max_allowed_packet instead.
--max-prepared-stmt-count=#
Maximum number of prepared statements in the server
--max-relay-log-size=#
@@ -729,6 +741,7 @@ abort-slave-event-count 0
allow-suspicious-udfs FALSE
auto-increment-increment 1
auto-increment-offset 1
+autocommit TRUE
automatic-sp-privileges TRUE
back-log 50
big-tables FALSE
@@ -737,6 +750,7 @@ binlog-cache-size 32768
binlog-direct-non-transactional-updates FALSE
binlog-format STATEMENT
binlog-row-event-max-size 1024
+binlog-stmt-cache-size 32768
bulk-insert-buffer-size 8388608
character-set-client-handshake TRUE
character-set-filesystem binary
@@ -815,6 +829,7 @@ max-allowed-packet 1048576
max-binlog-cache-size 18446744073709547520
max-binlog-dump-events 0
max-binlog-size 1073741824
+max-binlog-stmt-cache-size 18446744073709547520
max-connect-errors 10
max-connections 151
max-delayed-threads 20
@@ -822,6 +837,7 @@ max-error-count 64
max-heap-table-size 16777216
max-join-size 18446744073709551615
max-length-for-sort-data 1024
+max-long-data-size 1048576
max-prepared-stmt-count 16382
max-relay-log-size 0
max-seeks-for-key 18446744073709551615
@@ -919,7 +935,6 @@ slave-transaction-retries 10
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
-socket MySQL
sort-buffer-size 2097152
sporadic-binlog-dump-fail FALSE
sql-mode
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 87e7d837587..9f1d1a50ef1 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1), (2);
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="MUL" Extra="" Comment="" />
<key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" Index_comment="" />
</table_structure>
<table_data name="t1">
@@ -151,9 +151,9 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
- <field Field="b" Type="text" Null="YES" Key="" Extra="" />
- <field Field="c" Type="varchar(3)" Null="YES" Key="" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="b" Type="text" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="c" Type="varchar(3)" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -179,7 +179,7 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Extra="" />
+ <field Field="a&quot;b&quot;" Type="char(2)" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -1613,10 +1613,10 @@ CREATE TABLE `t2` (
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="mysqldump_test_db">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
<table_structure name="t2">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
</database>
</mysqldump>
@@ -1624,10 +1624,10 @@ CREATE TABLE `t2` (
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="mysqldump_test_db">
<table_structure name="t1">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
<table_structure name="t2">
- <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
</database>
</mysqldump>
@@ -3645,8 +3645,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="t1">
- <field Field="f1" Type="int(10)" Null="YES" Key="" Extra="" />
- <field Field="data" Type="mediumblob" Null="YES" Key="" Extra="" />
+ <field Field="f1" Type="int(10)" Null="YES" Key="" Extra="" Comment="" />
+ <field Field="data" Type="mediumblob" Null="YES" Key="" Extra="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
@@ -4577,5 +4577,89 @@ LENGTH(a)
800
DROP TABLE t1, t2;
#
+# Bug #13618 : mysqldump --xml ommit comment on table field
+#
+CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT';
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="test">
+ <table_structure name="comment_table">
+ <field Field="i" Type="int(11)" Null="YES" Key="" Extra="" Comment="FIELD COMMENT" />
+ </table_structure>
+ <table_data name="comment_table">
+ </table_data>
+</database>
+</mysqldump>
+DROP TABLE `comment_table`;
+#
+# BUG#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH ("-") IN
+# DATABASE NAMES IN ALTER DATABASE
+#
+CREATE DATABASE `test-database`;
+USE `test-database`;
+CREATE TABLE `test` (`c1` VARCHAR(10)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+CREATE TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN
+END |
+ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci;
+ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `test` (
+ `c1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+/*!40101 SET character_set_client = @saved_cs_client */;
+ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = latin1 */ ;
+/*!50003 SET character_set_results = latin1 */ ;
+/*!50003 SET collation_connection = latin1_swedish_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN
+END */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
+DROP DATABASE `test-database`;
+USE test;
+#
# End of 5.1 tests
#
+#
+# Verify that two modes can be given in --compatible;
+# and are reflected in SET SQL_MODE in the mysqldump output.
+# Also verify that a prefix of the mode's name is enough.
+#
+CREATE TABLE t1 (a INT);
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+);
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;
diff --git a/mysql-test/r/mysqldump_restore.result b/mysql-test/r/mysqldump_restore.result
index 16698251913..9eac8b253de 100644
--- a/mysql-test/r/mysqldump_restore.result
+++ b/mysql-test/r/mysqldump_restore.result
@@ -20,7 +20,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Compare original and recreated tables
# Recreated table: test.t1
# Original table: test.t1_orig
-Comparing tables test.t1 and test.t1_orig
+include/diff_tables.inc [test.t1, test.t1_orig]
# Cleanup
DROP TABLE test.t1, test.t1_orig;
#
@@ -45,7 +45,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Compare original and recreated tables
# Recreated table: test.t1
# Original table: test.t1_orig
-Comparing tables test.t1 and test.t1_orig
+include/diff_tables.inc [test.t1, test.t1_orig]
# Cleanup
DROP TABLE test.t1, test.t1_orig;
#
@@ -63,7 +63,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Compare original and recreated tables
# Recreated table: test.t1
# Original table: test.t1_orig
-Comparing tables test.t1 and test.t1_orig
+include/diff_tables.inc [test.t1, test.t1_orig]
# Cleanup
DROP TABLE test.t1, test.t1_orig;
#
@@ -82,7 +82,7 @@ ALTER TABLE test.t2 RENAME to test.t2_orig;
# Compare original and recreated tables
# Recreated table: test.t2
# Original table: test.t2_orig
-Comparing tables test.t2 and test.t2_orig
+include/diff_tables.inc [test.t2, test.t2_orig]
# Cleanup
DROP TABLE test.t2, test.t2_orig;
DROP TABLE t1;
@@ -100,7 +100,7 @@ ALTER TABLE test.t1 RENAME to test.t1_orig;
# Compare original and recreated tables
# Recreated table: test.t1
# Original table: test.t1_orig
-Comparing tables test.t1 and test.t1_orig
+include/diff_tables.inc [test.t1, test.t1_orig]
# Cleanup
DROP TABLE test.t1, test.t1_orig;
# End tests
diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result
index c113f18bd3f..9defe1d6093 100644
--- a/mysql-test/r/mysqlslap.result
+++ b/mysql-test/r/mysqlslap.result
@@ -219,3 +219,25 @@ DROP SCHEMA IF EXISTS `mysqlslap`;
DROP PROCEDURE IF EXISTS p1;
CREATE PROCEDURE p1() SELECT 1;
DROP PROCEDURE p1;
+#
+# Bug #11765157 - 58090: mysqlslap drops schema specified in
+# create_schema if auto-generate-sql also set.
+#
+# 'bug58090' database should not be present.
+SHOW DATABASES;
+Database
+information_schema
+mtr
+mysql
+performance_schema
+test
+# 'bug58090' database should be present.
+SHOW DATABASES;
+Database
+information_schema
+bug58090
+mtr
+mysql
+performance_schema
+test
+DROP DATABASE bug58090;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index edb1ec72070..8f72669ac06 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -309,11 +309,36 @@ var3 two columns with same name
var4 from query that returns NULL
var5 from query that returns no row
failing query in let
+create table t1 (a varchar(100));
+insert into t1 values ('`select 42`');
+`select 42`
+insert into t1 values ('$dollar');
+$dollar
+`select 42`
+drop table t1;
mysqltest: At line 1: Error running query 'failing query': 1064 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 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
-mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
-mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1
+mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql":
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1:
+At line 1: Source directives are nesting too deep
+mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql":
+included from MYSQLTEST_VARDIR/tmp/error.sql at line 1:
+At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1
2 = outer loop variable after while
here is the sourced script
@@ -370,23 +395,24 @@ mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_s
mysqltest: At line 1: Invalid argument to sleep "abc"
mysqltest: At line 1: Invalid argument to real_sleep "abc"
1
-2
101
-hej
-1
+-99
mysqltest: At line 1: Missing argument to inc
mysqltest: At line 1: The argument to inc must be a variable (start with $)
+mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
mysqltest: At line 1: End of line junk detected: "1000"
-4
-4
+mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
+mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
+-96
+-96
-1
--2
99
-hej
--1
mysqltest: At line 1: Missing argument to dec
mysqltest: At line 1: The argument to dec must be a variable (start with $)
+mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
mysqltest: At line 1: End of line junk detected: "1000"
+mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
+mysqltest: At line 1: Cannot perform inc/dec on a non-numeric value
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
system command 'NonExistsinfComamdn 2> /dev/null' failed
@@ -399,13 +425,50 @@ true-inner
true-inner again
true-outer
Counter is greater than 0, (counter=10)
+Counter should still be 10, is 10
Counter is not 0, (counter=0)
+Not space var works
Counter is true, (counter=alpha)
-Beta is true
while with string, only once
+5<7
+5<7 again
+5<7 still
+5<6
+5>=5
+5>=5 again
+5>3
+5==5
+5!=8
+5!=five
+5==3+2
+5 == 5
+hello == hello
+hello == hello
+hello != goodbye
+'quoted' == ''quoted''
+two words
+'two words'
+"two words"
+two words are two words
+right answer
+anything goes
+0 != string
+mysqltest: At line 2: Only == and != are supported for string values
+mysqltest: At line 2: Found junk '~= 6' after $variable in condition
+mysqltest: At line 2: Expression in if/while must beging with $, ` or a number
+mysqltest: At line 1: Missing right operand in comparison
+mysqltest: At line 1: Missing right operand in comparison
+counter is 2
+counter is 3
+counter is 4
+counter is 5
+counter is 6
+counter is 7
1
Testing while with not
-mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
+mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc":
+included from MYSQLTEST_VARDIR/tmp/mysqltest_while.inc at line 65:
+At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while
mysqltest: At line 1: Missing '{' after while. Found "dec $i"
@@ -454,8 +517,12 @@ mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
200 connects succeeded
-mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
-mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
+mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql":
+included from MYSQLTEST_VARDIR/tmp/mysqltest.sql at line 3:
+At line 3: connection 'test_con1' not found in connection pool
+mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql":
+included from MYSQLTEST_VARDIR/tmp/mysqltest.sql at line 2:
+At line 2: Connection test_con1 already exists
show tables;
ERROR 3D000: No database selected
connect con1,localhost,root,,;
@@ -586,7 +653,7 @@ if things work as expected
Some data
for cat_file command
of mysqltest
-mysqltest: At line 1: command "cat_file" failed with error 1
+mysqltest: At line 1: command "cat_file" failed with error 1. (my_errno)
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
@@ -799,7 +866,7 @@ drop table t1;
mysqltest: At line 1: change user failed: Unknown database 'inexistent'
mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
-file1.txt
+REPLACED_FILE1.txt
file1.txt
file2.txt
file11.txt
@@ -807,8 +874,6 @@ dir-list.txt
SELECT 'c:\\a.txt' AS col;
col
z
-hej
-mysqltest: At line 1: Found junk ' != 143' after $variable in expression
select 1;
1
1
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index fac38624695..eccf6151d33 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -3,14 +3,47 @@ SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value
slave_skip_errors OFF
#
+# Bug#58026: massive recursion and crash in regular expression handling
+#
+SELECT '1' RLIKE RPAD('1', 10000, '(');
+#
# WL#4284: Transactional DDL locking
#
# FLUSH PRIVILEGES should not implicitly unlock locked tables.
#
-drop table if exists t1;
-create table t1 (c1 int);
-lock tables t1 read;
-flush privileges;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT);
+LOCK TABLES t1 READ;
+FLUSH PRIVILEGES;
ERROR HY000: Table 'host' was not locked with LOCK TABLES
-unlock tables;
-drop table t1;
+UNLOCK TABLES;
+DROP TABLE t1;
+#
+# Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
+#
+CREATE USER nopriv_user@localhost;
+connection: default
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP FUNCTION IF EXISTS f;
+CREATE TABLE t1 (key1 INT PRIMARY KEY);
+CREATE TABLE t2 (key2 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
+FLUSH PRIVILEGES;
+connection: con1
+SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '<outfile>';
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+connection: default
+DROP TABLE t1,t2;
+DROP FUNCTION f;
+DROP USER nopriv_user@localhost;
+#
+# End Bug#54812
+#
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index d87aeefbc34..72bbaa71da5 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -44,13 +44,13 @@ ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
drop table t1;
-mysqltest: Could not open connection 'default': 2026 SSL error: ASN: bad other signature confirmation
-mysqltest: Could not open connection 'default': 2026 SSL error: ASN: bad other signature confirmation
-mysqltest: Could not open connection 'default': 2026 SSL error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
SSL error: Unable to get private key from ''
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get private key
SSL error: Unable to get certificate from ''
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get certificate
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
@@ -83,7 +83,7 @@ Ssl_cipher AES128-SHA
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher AES128-SHA
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: SSL_CTX_new failed
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
@@ -189,7 +189,7 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
SSL error: Unable to get private key from 'MYSQL_TEST_DIR/std_data/client-cert.pem'
-mysqldump: Got error: 2026: "SSL connection error" when trying to connect
+mysqldump: Got error: 2026: SSL connection error: Unable to get private key when trying to connect
DROP TABLE t1;
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index c92e3696c21..1405893213d 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -1430,9 +1430,11 @@ set session sort_buffer_size= 30000;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '30000'
set session max_sort_length= 2180;
+CALL mtr.add_suppression("Out of sort memory");
select * from t1 order by b;
-ERROR HY001: Out of sort memory; increase server sort buffer size
+ERROR HY001: Out of sort memory, consider increasing server sort buffer size
drop table t1;
+call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
#
# Bug #39844: Query Crash Mysql Server 5.0.67
#
@@ -1643,6 +1645,31 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 8 NULL 10 Using index; Using temporary; Using filesort
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where
DROP TABLE t1, t2;
+#
+# Bug #59110: Memory leak of QUICK_SELECT_I allocated memory
+# and
+# Bug #59308: Incorrect result for
+SELECT DISTINCT <col>... ORDER BY <col> DESC
+
+# Use Valgrind to detect #59110!
+#
+CREATE TABLE t1 (a INT,KEY (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index; Using filesort
+SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
+a 1
+10 1
+9 1
+8 1
+7 1
+6 1
+5 1
+4 1
+3 1
+2 1
+DROP TABLE t1;
End of 5.1 tests
#
# Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index ecbb47d4ee0..dcc2c608d0b 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -3,6 +3,7 @@ set @net_buffer_length=@@global.net_buffer_length;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global net_buffer_length=100;
Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100'
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 83ff66eabe5..0febdbc38d0 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,5 +1,105 @@
drop table if exists t1, t2;
#
+# Bug#11765667: bug#58655: ASSERTION FAILED,
+# SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
+#
+CREATE TABLE t1 (
+id MEDIUMINT NOT NULL AUTO_INCREMENT,
+dt DATE, st VARCHAR(255), uid INT,
+id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
+);
+INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
+('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
+('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
+('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
+('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
+('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
+('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
+('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
+('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
+('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
+('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
+ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
+PARTITION d1 VALUES IN (1991, 1994),
+PARTITION d2 VALUES IN (1993),
+PARTITION d3 VALUES IN (1992, 1995, 1996)
+);
+INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
+('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
+UPDATE t1 SET filler='Updating the row' WHERE uid=298;
+DROP TABLE t1;
+#
+# Bug#59297: Can't find record in 'tablename' on update inner join
+#
+CREATE TABLE t1 (
+a char(2) NOT NULL,
+b char(2) NOT NULL,
+c int(10) unsigned NOT NULL,
+d varchar(255) DEFAULT NULL,
+e varchar(1000) DEFAULT NULL,
+PRIMARY KEY (a, b, c),
+KEY (a),
+KEY (a, b)
+)
+/*!50100 PARTITION BY KEY (a)
+PARTITIONS 20 */;
+INSERT INTO t1 (a, b, c, d, e) VALUES
+('07', '03', 343, '1', '07_03_343'),
+('01', '04', 343, '2', '01_04_343'),
+('01', '06', 343, '3', '01_06_343'),
+('01', '07', 343, '4', '01_07_343'),
+('01', '08', 343, '5', '01_08_343'),
+('01', '09', 343, '6', '01_09_343'),
+('03', '03', 343, '7', '03_03_343'),
+('03', '06', 343, '8', '03_06_343'),
+('03', '07', 343, '9', '03_07_343'),
+('04', '03', 343, '10', '04_03_343'),
+('04', '06', 343, '11', '04_06_343'),
+('05', '03', 343, '12', '05_03_343'),
+('11', '03', 343, '13', '11_03_343'),
+('11', '04', 343, '14', '11_04_343')
+;
+UPDATE t1 AS A,
+(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B
+SET A.e = B.d
+WHERE A.a = '03'
+AND A.b = '06'
+AND A.c = 343;
+DROP TABLE t1;
+#
+# Bug#57778: failed primary key add to partitioned innodb table
+# inconsistent and crashes
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (0,1), (0,2);
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (a)
+PARTITIONS 2 */
+SELECT * FROM t1;
+a b
+0 1
+0 2
+UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SELECT * FROM t1;
+a b
+1 1
+0 1
+ALTER TABLE t1 DROP PRIMARY KEY;
+SELECT * FROM t1;
+a b
+1 1
+0 1
+DROP TABLE t1;
+#
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
@@ -118,6 +218,15 @@ a b
2007-07-30 17:35:48 p1
2009-07-14 17:35:55 pmax
2009-09-21 17:31:42 pmax
+SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+a b
+2007-07-30 17:35:48 p1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
PARTITION p3 VALUES LESS THAN (1247688000),
PARTITION pmax VALUES LESS THAN MAXVALUE);
@@ -126,6 +235,15 @@ a b
2007-07-30 17:35:48 p1
2009-07-14 17:35:55 pmax
2009-09-21 17:31:42 pmax
+SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+a b
+2007-07-30 17:35:48 p1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
+EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -566,12 +684,12 @@ create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
-ERROR HY000: VALUES value must be of same type as partition function
+ERROR HY000: VALUES value for partition 'p0' must have type INT
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
partition p1 values in (10));
-ERROR HY000: VALUES value must be of same type as partition function
+ERROR HY000: VALUES value for partition 'p0' must have type INT
create table t1 (a bigint unsigned)
partition by range (a)
(partition p0 values less than (100),
@@ -1868,7 +1986,7 @@ c1 bigint,
c2 set('sweet'),
key (c2,c1,c0),
key(c0)
-) engine=myisam partition by hash (month(c0)) partitions 5;
+) engine=myisam partition by hash (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);
@@ -2231,3 +2349,51 @@ INSERT INTO t1 VALUES(0);
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
End of 5.1 tests
+#
+# BUG#55385: UPDATE statement throws an error, but still updates
+# the table entries
+CREATE TABLE t1_part (
+partkey int,
+nokey int
+) PARTITION BY LINEAR HASH(partkey) PARTITIONS 3;
+INSERT INTO t1_part VALUES (1, 1) , (10, 10);
+CREATE VIEW v1 AS SELECT * FROM t1_part;
+
+# Should be (1,1),(10,10)
+SELECT * FROM t1_part;
+partkey nokey
+1 1
+10 10
+
+# Case 1
+# Update is refused because partitioning key is updated
+UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.partkey = 2, B.nokey = 3;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2, B.partkey = 3;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+# Case 2
+# Like 1, but partition accessed through a view
+UPDATE t1_part AS A NATURAL JOIN v1 as B SET A.nokey = 2 , B.partkey = 3;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+UPDATE v1 AS A NATURAL JOIN t1_part as B SET A.nokey = 2 , B.partkey = 3;
+ERROR HY000: Primary key/partition key update is not allowed since the table is updated both as 'A' and 'B'.
+
+# Should be (1,1),(10,10)
+SELECT * FROM t1_part;
+partkey nokey
+1 1
+10 10
+
+# Case 3
+# Update is accepted because partitioning key is not updated
+UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2 , B.nokey = 3;
+
+# Should be (1,3),(10,3)
+SELECT * FROM t1_part;
+partkey nokey
+1 3
+10 3
+
+DROP VIEW v1;
+DROP TABLE t1_part;
diff --git a/mysql-test/r/partition_binlog.result b/mysql-test/r/partition_binlog.result
new file mode 100644
index 00000000000..c8fa02c4b99
--- /dev/null
+++ b/mysql-test/r/partition_binlog.result
@@ -0,0 +1,49 @@
+DROP TABLE IF EXISTS t1;
+#
+# Bug#58147: ALTER TABLE w/ TRUNCATE PARTITION fails
+# but the statement is written to binlog
+#
+CREATE TABLE t1(id INT)
+PARTITION BY RANGE (id)
+(PARTITION p0 VALUES LESS THAN (100),
+PARTITION pmax VALUES LESS THAN (MAXVALUE));
+INSERT INTO t1 VALUES (1), (10), (100), (1000);
+ALTER TABLE t1 TRUNCATE PARTITION p1;
+ERROR HY000: Incorrect partition name
+ALTER TABLE t1 DROP PARTITION p1;
+ERROR HY000: Error in list of partitions to DROP
+# No error returned, output in table format instead:
+ALTER TABLE t1 ANALYZE PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 analyze error Error in list of partitions to test.t1
+ALTER TABLE t1 CHECK PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 check error Error in list of partitions to test.t1
+ALTER TABLE t1 OPTIMIZE PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 optimize error Error in list of partitions to test.t1
+ALTER TABLE t1 REPAIR PARTITION p1;
+Table Op Msg_type Msg_text
+test.t1 repair error Error in list of partitions to test.t1
+ALTER TABLE t1 ANALYZE PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+ALTER TABLE t1 CHECK PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 OPTIMIZE PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+ALTER TABLE t1 REPAIR PARTITION p0;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+ALTER TABLE t1 TRUNCATE PARTITION p0;
+ALTER TABLE t1 DROP PARTITION p0;
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 ANALYZE PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 OPTIMIZE PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 REPAIR PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 TRUNCATE PARTITION p0
+master-bin.000001 # Query # # use `test`; ALTER TABLE t1 DROP PARTITION p0
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result
index 47ea799f497..651d924d7e5 100644
--- a/mysql-test/r/partition_datatype.result
+++ b/mysql-test/r/partition_datatype.result
@@ -338,3 +338,1003 @@ select hex(a) from t1 where a = 7;
hex(a)
7
drop table t1;
+#
+# Bug#28928: UNIX_TIMESTAMP() should be considered unary monotonic
+# by partition pruning
+SET @old_time_zone= @@session.time_zone;
+SET @@session.time_zone = 'UTC';
+# Using MyISAM to get stable values on TABLE_ROWS in I_S.PARTITIONS
+CREATE TABLE t1
+(a TIMESTAMP NULL,
+tz varchar(16))
+ENGINE = MyISAM;
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE t2 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION `p0` VALUES LESS THAN (0),
+PARTITION `p-2000` VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01')),
+PARTITION `p-2011-MSK` VALUES LESS THAN (UNIX_TIMESTAMP('2011-03-26 23:00:00')),
+PARTITION `p-2011-MSD-1` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-29 22:00:00')),
+PARTITION `p-2011-MSD-2` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-29 23:00:00')),
+PARTITION `p-2012-MSK-1` VALUES LESS THAN (UNIX_TIMESTAMP('2011-10-30 00:00:00')),
+PARTITION `p-2012-MSK-2` VALUES LESS THAN (UNIX_TIMESTAMP('2012-03-24 23:00:00')),
+PARTITION `pEnd` VALUES LESS THAN (UNIX_TIMESTAMP('2038-01-19 03:14:07')),
+PARTITION `pMax` VALUES LESS THAN MAXVALUE);
+# Test 'odd' values
+INSERT INTO t1 VALUES (NULL, 'UTC');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'UTC');
+# Test invalid values
+INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('2038-01-19 03:14:08', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1970-01-01 00:00:00', 'UTCI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+# Test start range
+INSERT INTO t1 VALUES ('1970-01-01 00:00:01', 'UTC');
+INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'UTC');
+# Test end range
+INSERT INTO t1 VALUES ('2038-01-19 03:14:06', 'UTC');
+INSERT INTO t1 VALUES ('2038-01-19 03:14:07', 'UTC');
+# Test Daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-26 22:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-03-26 23:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-03-26 23:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 21:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 22:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:00:01', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-29 23:59:59', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-30 00:00:00', 'UTC');
+INSERT INTO t1 VALUES ('2011-10-30 00:00:01', 'UTC');
+SET @@session.time_zone = 'Europe/Moscow';
+# Test 'odd' values
+INSERT INTO t1 VALUES (NULL, 'Moscow');
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'Moscow');
+# Test invalid values
+INSERT INTO t1 VALUES ('0000-00-00 03:00:00', 'MoscowI');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+INSERT INTO t1 VALUES ('1901-01-01 00:00:00', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1969-12-31 23:59:59', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1970-01-01 02:29:29', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('2038-01-19 06:14:08', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+INSERT INTO t1 VALUES ('1970-01-01 03:00:00', 'MoscowI');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+# values truncated to 03:00:00 due to daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-27 02:00:00', 'MoscowI');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+INSERT INTO t1 VALUES ('2011-03-27 02:00:01', 'MoscowI');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+INSERT INTO t1 VALUES ('2011-03-27 02:59:59', 'MoscowI');
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1
+# Test start range
+INSERT INTO t1 VALUES ('1970-01-01 03:00:01', 'Moscow');
+INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'Moscow');
+# Test end range
+INSERT INTO t1 VALUES ('2038-01-19 06:14:06', 'Moscow');
+INSERT INTO t1 VALUES ('2038-01-19 06:14:07', 'Moscow');
+# Test Daylight saving shift
+INSERT INTO t1 VALUES ('2011-03-27 01:59:59', 'Moscow');
+INSERT INTO t1 VALUES ('2011-03-27 03:00:00', 'Moscow');
+INSERT INTO t1 VALUES ('2011-03-27 03:00:01', 'Moscow');
+INSERT INTO t1 VALUES ('2011-10-30 01:59:59', 'Moscow');
+# All values between 02:00 and 02:59:59 will be interpretated as DST
+INSERT INTO t1 VALUES ('2011-10-30 02:00:00', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 02:00:01', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 02:59:59', 'MoscowD');
+INSERT INTO t1 VALUES ('2011-10-30 03:00:00', 'Moscow');
+INSERT INTO t1 VALUES ('2011-10-30 03:00:01', 'Moscow');
+SET @@session.time_zone = 'UTC';
+INSERT INTO t2 SELECT * FROM t1;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 2
+p-2000 16
+p-2011-MSK 2
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 3
+p-2012-MSK-2 4
+pEnd 2
+pMax 2
+SELECT * FROM t1 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 00:00:01 Moscow
+1970-01-01 00:00:01 UTC
+1974-02-05 18:28:16 Moscow
+1974-02-05 21:28:16 UTC
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2038-01-19 03:14:06 Moscow
+2038-01-19 03:14:06 UTC
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 00:00:01 Moscow
+1970-01-01 00:00:01 UTC
+1974-02-05 18:28:16 Moscow
+1974-02-05 21:28:16 UTC
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2038-01-19 03:14:06 Moscow
+2038-01-19 03:14:06 UTC
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
+a tz
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
+a tz
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
+a tz
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1 ALL NULL NULL NULL NULL 18 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
+a tz
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2 ALL NULL NULL NULL NULL 15 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 13 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 7 Using where; Using filesort
+# Test end range changes
+DELETE FROM t2 WHERE a = 0;
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+1
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 UTC
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+2038-01-19 03:14:06 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 34
+Warning 1264 Out of range value for column 'a' at row 35
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+0000-00-00 00:00:00 2038-01-19 03:14:07
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+2
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 3
+p-2000 6
+p-2011-MSK 0
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 4
+p-2012-MSK-2 5
+pEnd 0
+pMax 2
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 UTC
+1970-01-01 00:00:02 Moscow
+1970-01-01 00:00:02 UTC
+1974-02-05 18:28:17 Moscow
+1974-02-05 21:28:17 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 MoscowI
+2011-03-26 23:00:01 MoscowI
+2011-03-26 23:00:01 MoscowI
+2011-03-26 23:00:01 UTC
+2011-03-26 23:00:02 Moscow
+2011-03-26 23:00:02 UTC
+2011-10-29 22:00:00 Moscow
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:00:02 MoscowD
+2011-10-29 22:00:02 UTC
+2011-10-29 23:00:00 MoscowD
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:00:02 UTC
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2011-10-30 00:00:02 Moscow
+2011-10-30 00:00:02 UTC
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+# Test start range changes
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+3
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL UTC
+NULL UTC
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 03:14:07 Moscow
+2038-01-19 03:14:07 UTC
+2011-10-30 00:00:02 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+1970-01-01 00:00:01 2038-01-19 03:14:06
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+0
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 6
+p-2000 4
+p-2011-MSK 2
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 3
+p-2012-MSK-2 4
+pEnd 2
+pMax 0
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL Moscow
+NULL UTC
+NULL UTC
+NULL UTC
+NULL UTC
+1970-01-01 00:00:01 Moscow
+1970-01-01 00:00:01 UTC
+1974-02-05 18:28:16 Moscow
+1974-02-05 21:28:16 UTC
+2011-03-26 22:59:59 Moscow
+2011-03-26 22:59:59 UTC
+2011-03-26 23:00:00 Moscow
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 MoscowI
+2011-03-26 23:00:00 UTC
+2011-03-26 23:00:01 Moscow
+2011-03-26 23:00:01 UTC
+2011-10-29 21:59:59 Moscow
+2011-10-29 21:59:59 UTC
+2011-10-29 22:00:00 MoscowD
+2011-10-29 22:00:00 UTC
+2011-10-29 22:00:01 MoscowD
+2011-10-29 22:00:01 UTC
+2011-10-29 22:59:59 MoscowD
+2011-10-29 22:59:59 UTC
+2011-10-29 23:00:00 UTC
+2011-10-29 23:00:01 UTC
+2011-10-29 23:59:59 UTC
+2011-10-30 00:00:00 Moscow
+2011-10-30 00:00:00 UTC
+2011-10-30 00:00:01 Moscow
+2011-10-30 00:00:01 UTC
+2038-01-19 03:14:06 Moscow
+2038-01-19 03:14:06 UTC
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` timestamp NULL DEFAULT NULL,
+ `tz` varchar(16) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
+ PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
+ PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+TRUNCATE TABLE t2;
+SET @@session.time_zone = 'Europe/Moscow';
+INSERT INTO t2 SELECT * FROM t1;
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 2
+p-2000 16
+p-2011-MSK 2
+p-2011-MSD-1 9
+p-2011-MSD-2 6
+p-2012-MSK-1 3
+p-2012-MSK-2 4
+pEnd 2
+pMax 2
+SELECT * FROM t1 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 03:00:01 Moscow
+1970-01-01 03:00:01 UTC
+1974-02-05 21:28:16 Moscow
+1974-02-06 00:28:16 UTC
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2038-01-19 06:14:06 Moscow
+2038-01-19 06:14:06 UTC
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 MoscowI
+0000-00-00 00:00:00 UTC
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+0000-00-00 00:00:00 UTCI
+1970-01-01 03:00:01 Moscow
+1970-01-01 03:00:01 UTC
+1974-02-05 21:28:16 Moscow
+1974-02-06 00:28:16 UTC
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2038-01-19 06:14:06 Moscow
+2038-01-19 06:14:06 UTC
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+# Testing the leap from 01:59:59 to 03:00:00
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+a tz
+2011-03-27 01:59:59 Moscow
+2011-03-27 01:59:59 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort
+# Testing the leap from 02:59:59 to 02:00:00
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
+a tz
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+a tz
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+EXPLAIN PARTITIONS
+SELECT * FROM t2
+WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort
+# Test end range changes
+DELETE FROM t2 WHERE a = 0;
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+1
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+2038-01-19 06:14:06 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 8
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 9
+Warning 1264 Out of range value for column 'a' at row 34
+Warning 1264 Out of range value for column 'a' at row 35
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+0000-00-00 00:00:00 2038-01-19 06:14:07
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+35
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+2
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 3
+p-2000 6
+p-2011-MSK 0
+p-2011-MSD-1 9
+p-2011-MSD-2 8
+p-2012-MSK-1 0
+p-2012-MSK-2 7
+pEnd 0
+pMax 2
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL Moscow
+NULL UTC
+0000-00-00 00:00:00 Moscow
+0000-00-00 00:00:00 UTC
+1970-01-01 03:00:02 Moscow
+1970-01-01 03:00:02 UTC
+1974-02-05 21:28:17 Moscow
+1974-02-06 00:28:17 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 MoscowI
+2011-03-27 03:00:01 MoscowI
+2011-03-27 03:00:01 MoscowI
+2011-03-27 03:00:01 UTC
+2011-03-27 03:00:02 Moscow
+2011-03-27 03:00:02 UTC
+2011-10-30 02:00:00 Moscow
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:00:02 MoscowD
+2011-10-30 02:00:02 UTC
+2011-10-30 02:00:02 UTC
+2011-10-30 03:00:00 MoscowD
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2011-10-30 03:00:02 Moscow
+2011-10-30 03:00:02 UTC
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+# Test start range changes
+INSERT INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+3
+SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
+a tz
+NULL Moscow
+NULL Moscow
+NULL UTC
+SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
+a tz
+2038-01-19 06:14:07 Moscow
+2038-01-19 06:14:07 UTC
+2011-10-30 03:00:02 Moscow
+UPDATE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
+Warnings:
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 18
+Warning 1299 Invalid TIMESTAMP value in column 'a' at row 19
+SELECT MIN(a), MAX(a) FROM t2;
+MIN(a) MAX(a)
+1970-01-01 03:00:01 2038-01-19 06:14:06
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+36
+SELECT COUNT(*) FROM t2 WHERE a = 0;
+COUNT(*)
+0
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
+WHERE TABLE_NAME = 't2';
+PARTITION_NAME TABLE_ROWS
+p0 6
+p-2000 4
+p-2011-MSK 0
+p-2011-MSD-1 11
+p-2011-MSD-2 9
+p-2012-MSK-1 0
+p-2012-MSK-2 4
+pEnd 2
+pMax 0
+SELECT * FROM t2 ORDER BY a, tz;
+a tz
+NULL Moscow
+NULL Moscow
+NULL Moscow
+NULL Moscow
+NULL UTC
+NULL UTC
+1970-01-01 03:00:01 Moscow
+1970-01-01 03:00:01 UTC
+1974-02-05 21:28:16 Moscow
+1974-02-06 00:28:16 UTC
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 Moscow
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 MoscowI
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:00 UTC
+2011-03-27 03:00:01 Moscow
+2011-03-27 03:00:01 UTC
+2011-10-30 01:59:59 Moscow
+2011-10-30 01:59:59 UTC
+2011-10-30 02:00:00 MoscowD
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:00 UTC
+2011-10-30 02:00:01 MoscowD
+2011-10-30 02:00:01 UTC
+2011-10-30 02:00:01 UTC
+2011-10-30 02:59:59 MoscowD
+2011-10-30 02:59:59 UTC
+2011-10-30 02:59:59 UTC
+2011-10-30 03:00:00 Moscow
+2011-10-30 03:00:00 UTC
+2011-10-30 03:00:01 Moscow
+2011-10-30 03:00:01 UTC
+2038-01-19 06:14:06 Moscow
+2038-01-19 06:14:06 UTC
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` timestamp NULL DEFAULT NULL,
+ `tz` varchar(16) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
+(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
+ PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
+ PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
+ PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
+ PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
+ PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
+ PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+TRUNCATE TABLE t2;
+DROP TABLE t1, t2;
+SET @@session.time_zone= @old_time_zone;
diff --git a/mysql-test/r/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result
index 0e3241cf88e..6b8c8e48acc 100644
--- a/mysql-test/r/partition_debug_sync.result
+++ b/mysql-test/r/partition_debug_sync.result
@@ -25,7 +25,7 @@ ALTER TABLE t1 REMOVE PARTITIONING;
# Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR partitioning_removed';
DROP TABLE IF EXISTS t1;
# Con 1
SET SESSION debug= "-d,sleep_before_create_table_no_lock";
@@ -51,12 +51,12 @@ SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default
-SET SESSION debug= "+d,sleep_before_part2_delete_table";
+SET SESSION debug= "+d,sleep_before_no_locks_delete_table";
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
-SET DEBUG_SYNC= 'rm_table_part2_before_delete_table SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
+SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
-SET SESSION debug= "-d,sleep_before_part2_delete_table";
+SET SESSION debug= "-d,sleep_before_no_locks_delete_table";
# Con 1
ERROR 42S02: Table 'test.t2' doesn't exist
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 8fe16fd7afb..252a6b4386a 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -1,20 +1,717 @@
-drop table if exists t1;
+drop table if exists t1, t2;
#
-# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
+# Bug#57924: crash when creating partitioned table with
+# multiple columns in the partition key
#
-CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
-FLUSH TABLES;
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check Error Failed to read from the .par file
-test.t1 check Error Incorrect information in file: './test/t1.frm'
-test.t1 check error Corrupt
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(a, b, a);
+ERROR HY000: Duplicate partition field name 'a'
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(A, b);
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(a, b, A);
+ERROR HY000: Duplicate partition field name 'a'
+#
+# Bug#54483: valgrind errors when making warnings for multiline inserts
+# into partition
+#
+CREATE TABLE t1 (a VARBINARY(10))
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a CHAR(10))
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIMESTAMP)
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+INSERT INTO t1 VALUES ('test'),('a'),('5');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'a' at row 3
+SHOW WARNINGS;
+Level Code Message
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'a' at row 3
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+INSERT INTO t1 VALUES ('test'),('a'),('5');
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
+SHOW WARNINGS;
+Level Code Message
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1264 Out of range value for column 'a' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME)
+PARTITION BY RANGE (DAYOFWEEK(a))
+(PARTITION a1 VALUES LESS THAN (60));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+SHOW WARNINGS;
+Level Code Message
+Error 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (TO_DAYS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (TO_DAYS(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (TO_DAYS(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (TO_DAYS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (TO_DAYS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (DAYOFMONTH(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (DAYOFMONTH(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (DAYOFMONTH(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (DAYOFMONTH(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (DAYOFMONTH(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (MONTH(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (MONTH(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (MONTH(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (MONTH(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (MONTH(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (DAYOFYEAR(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (DAYOFYEAR(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (DAYOFYEAR(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (DAYOFYEAR(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (DAYOFYEAR(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (HOUR(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (HOUR(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (HOUR(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (HOUR(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (HOUR(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (MINUTE(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (MINUTE(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (MINUTE(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (MINUTE(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (MINUTE(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (QUARTER(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (QUARTER(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (QUARTER(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (QUARTER(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (QUARTER(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (SECOND(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (SECOND(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (SECOND(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (SECOND(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (SECOND(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (YEARWEEK(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (YEARWEEK(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (YEARWEEK(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (YEARWEEK(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (YEARWEEK(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (WEEKDAY(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (WEEKDAY(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (WEEKDAY(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (WEEKDAY(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (WEEKDAY(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+# TO_SECONDS() is added in 5.5.
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (TO_SECONDS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (TO_SECONDS(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (TO_SECONDS(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (TO_SECONDS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (TO_SECONDS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (TIME_TO_SEC(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (TIME_TO_SEC(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (TIME_TO_SEC(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (TIME_TO_SEC(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (TIME_TO_SEC(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (FROM_DAYS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (FROM_DAYS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (FROM_DAYS(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (FROM_DAYS(a));
+ERROR HY000: The PARTITION function returns the wrong type
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (FROM_DAYS(a));
+ERROR HY000: The PARTITION function returns the wrong type
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (MICROSECOND(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (MICROSECOND(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (MICROSECOND(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (MICROSECOND(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (MICROSECOND(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+# Bug#57071
+CREATE TABLE t1
+(`date` date,
+`extracted_week` int,
+`yearweek` int,
+`week` int,
+`default_week_format` int)
+PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3)
+(PARTITION p0 VALUES IN (0),
+PARTITION p1 VALUES IN (1),
+PARTITION p2 VALUES IN (2));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1
+(`date` date,
+`extracted_week` int,
+`yearweek` int,
+`week` int,
+`default_week_format` int);
+SET @old_default_week_format := @@default_week_format;
+SET default_week_format = 0;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 1;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 2;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 3;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 4;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 5;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 6;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
+SET default_week_format = 7;
+INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
SELECT * FROM t1;
-ERROR HY000: Failed to read from the .par file
-# Note that it is currently impossible to drop a partitioned table
-# without the .par file
+date extracted_week yearweek week default_week_format
+2000-01-01 0 199952 0 0
+2000-01-01 0 199952 0 1
+2000-01-01 52 199952 52 2
+2000-01-01 52 199952 52 3
+2000-01-01 0 199952 0 4
+2000-01-01 0 199952 0 5
+2000-01-01 52 199952 52 6
+2000-01-01 52 199952 52 7
+SET default_week_format = @old_default_week_format;
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(YEAR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(YEAR FROM a));
DROP TABLE t1;
-ERROR 42S02: Unknown table 't1'
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(YEAR FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(YEAR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(YEAR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(QUARTER FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(QUARTER FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(QUARTER FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(QUARTER FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(QUARTER FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(MONTH FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(MONTH FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(MONTH FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(MONTH FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(MONTH FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+# EXTRACT(WEEK...) is disallowed, see bug#57071.
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(WEEK FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(WEEK FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(WEEK FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(WEEK FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(WEEK FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(DAY FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(DAY FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(DAY FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(DAY FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(DAY FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(HOUR FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(HOUR FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(HOUR FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(MINUTE FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(MINUTE FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(MINUTE FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(SECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(SECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME, b DATE)
+PARTITION BY HASH (DATEDIFF(a, b));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATE, b DATETIME)
+PARTITION BY HASH (DATEDIFF(a, b));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATETIME, b DATE)
+PARTITION BY HASH (DATEDIFF(a, b));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE, b VARCHAR(10))
+PARTITION BY HASH (DATEDIFF(a, b));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT, b DATETIME)
+PARTITION BY HASH (DATEDIFF(a, b));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a TIME)
+PARTITION BY HASH (TIME_TO_SEC(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a DATE)
+PARTITION BY HASH (TIME_TO_SEC(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a DATETIME)
+PARTITION BY HASH (TIME_TO_SEC(a));
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(10))
+PARTITION BY HASH (TIME_TO_SEC(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (TIME_TO_SEC(a));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+#
+# Bug#50036: Inconsistent errors when using TIMESTAMP
+# columns/expressions
+# 1. correct and appropriate errors in light of
+# the fix for BUG#42849:
+CREATE TABLE t1 (c TIMESTAMP)
+PARTITION BY RANGE (TO_DAYS(c))
+(PARTITION p0 VALUES LESS THAN (10000),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t2 (c TIMESTAMP);
+ALTER TABLE t2
+PARTITION BY RANGE (TO_DAYS(c))
+(PARTITION p0 VALUES LESS THAN (10000),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+CREATE TABLE t1 (c TIMESTAMP)
+PARTITION BY RANGE COLUMNS(c)
+(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
+ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c)
+(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
+DROP TABLE t2;
+# 2. These errors where questionable before the fix:
+# VALUES clause are checked first, clearified the error message.
+CREATE TABLE t1 (c TIMESTAMP)
+PARTITION BY RANGE (c)
+(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: VALUES value for partition 'p0' must have type INT
+# TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP).
+CREATE TABLE t1 (c TIMESTAMP)
+PARTITION BY RANGE (UNIX_TIMESTAMP(c))
+(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: VALUES value for partition 'p0' must have type INT
+CREATE TABLE t1 (c TIMESTAMP)
+PARTITION BY RANGE (UNIX_TIMESTAMP(c))
+(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+DROP TABLE t1;
+# Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
+CREATE TABLE t1 (c TIMESTAMP)
+PARTITION BY HASH (c) PARTITIONS 4;
+ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
+# Moved to partition_myisam, since it was MyISAM specific
+# Added test with existing TIMESTAMP partitioning (when it was allowed).
#
# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
# with temporary table and partitions
@@ -47,10 +744,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>) */
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
@@ -68,12 +765,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp0 ENGINE = MyISAM,
- SUBPARTITION sp1 ENGINE = MyISAM)) */
+ (SUBPARTITION sp0 ENGINE = <curr_engine>,
+ SUBPARTITION sp1 ENGINE = <curr_engine>)) */
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
@@ -88,53 +785,11 @@ Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
+(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>) */
DROP TABLE t1;
SET @@sql_mode= @org_mode;
-#
-# Bug#50392: insert_id is not reset for partitioned tables
-# auto_increment on duplicate entry
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
-SET INSERT_ID= 13;
-INSERT INTO t1 VALUES (NULL);
-SET INSERT_ID= 12;
-INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
-ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1;
-a
-12
-13
-14
-DROP TABLE t1;
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a);
-SET INSERT_ID= 13;
-INSERT INTO t1 VALUES (NULL);
-SET INSERT_ID= 12;
-INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
-ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY KEY (a) */
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1;
-a
-12
-13
-14
-DROP TABLE t1;
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
@@ -144,19 +799,6 @@ PARTITION BY KEY (a) PARTITIONS 2;
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1;
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (a)
-( PARTITION p0 ENGINE=MyISAM,
-PARTITION p1);
-ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
-CREATE TABLE t1 (a INT)
-PARTITION BY LIST (a)
-SUBPARTITION BY HASH (a)
-( PARTITION p0 VALUES IN (0)
-( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2),
-PARTITION p1 VALUES IN (1)
-( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM));
-ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
CREATE TABLE t1 (
a int
)
@@ -497,7 +1139,7 @@ partition by range (a)
partitions 2
(partition x1 values less than (4.0) tablespace ts1,
partition x2 values less than (8) tablespace ts2);
-ERROR HY000: VALUES value must be of same type as partition function
+ERROR HY000: VALUES value for partition 'x1' must have type INT
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -736,7 +1378,7 @@ partition by list (a)
partitions 2
(partition x1 values in (4.0, 12+8),
partition x2 values in (3, 21));
-ERROR HY000: VALUES value must be of same type as partition function
+ERROR HY000: VALUES value for partition 'x1' must have type INT
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -796,12 +1438,12 @@ CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
-ERROR HY000: The PARTITION function returns the wrong type
+ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
ALTER TABLE old
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
-ERROR HY000: The PARTITION function returns the wrong type
+ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819),
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index bbd69083038..da2f59f375e 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,12 +1,38 @@
+set global default_storage_engine='innodb';
+set session default_storage_engine='innodb';
drop table if exists t1, t2;
#
+# Bug#56287: crash when using Partition datetime in sub in query
+#
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+c2 varchar(40) not null default '',
+c3 datetime not NULL,
+PRIMARY KEY (c1,c3),
+KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+PARTITION p201912 VALUES LESS THAN MAXVALUE);
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+PARTITION_NAME TABLE_ROWS
+p200912 0
+p201103 1
+p201912 0
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+count(*)
+0
+DROP TABLE t1;
+#
# Bug#54747: Deadlock between REORGANIZE PARTITION and
# SELECT is not detected
#
SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency;
SET GLOBAL innodb_thread_concurrency = 1;
-set global default_storage_engine='innodb';
-set session default_storage_engine='innodb';
CREATE TABLE t1
(user_num BIGINT,
hours SMALLINT,
@@ -491,4 +517,32 @@ Warning 1265 Data truncated for column 'b' at row 1
Error 1067 Invalid default value for 'b'
SET SESSION sql_mode = @old_mode;
DROP TABLE t1;
+#
+# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
+# table unusable".
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
+ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
+INSERT INTO t1 values (0,1), (1,2);
+# The below ALTER should fail. It should leave the
+# table in its original, non-corrupted, usable state.
+ALTER TABLE t1 ADD UNIQUE KEY (b);
+ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function
+# The below statements should succeed, as ALTER should
+# have left table intact.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL,
+ `b` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (a)
+PARTITIONS 2 */
+SELECT * FROM t1;
+a b
+1 2
+0 1
+DROP TABLE t1;
set global default_storage_engine=default;
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index dd91eee316a..aa0944e96b5 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -1,3 +1,76 @@
+call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal");
+#
+# Bug#55091: Server crashes on ADD PARTITION after a failed attempt
+#
+SET @old_innodb_file_format_max = @@global.innodb_file_format_max;
+SET @old_innodb_file_format = @@global.innodb_file_format;
+SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
+SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
+SET @@global.innodb_file_format = Barracuda,
+@@global.innodb_file_per_table = ON,
+@@global.innodb_strict_mode = ON;
+# Connection con1
+CREATE TABLE t1 (id INT NOT NULL
+PRIMARY KEY,
+user_num CHAR(10)
+) ENGINE = InnoDB
+KEY_BLOCK_SIZE=4
+PARTITION BY HASH(id) PARTITIONS 1;
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `user_num` char(10) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
+/*!50100 PARTITION BY HASH (id)
+PARTITIONS 1 */
+SET GLOBAL innodb_file_per_table = OFF;
+# Connection con2
+LOCK TABLE t1 WRITE;
+# ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
+# are incompatible with innodb_file_per_table = OFF;
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ERROR HY000: Got error 1478 from storage engine
+t1#P#p0.ibd
+t1.frm
+t1.par
+# This SET is not needed to reproduce the bug,
+# it is here just to make the test case more realistic
+SET innodb_strict_mode = OFF;
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+t1.frm
+t1.par
+ALTER TABLE t1 REBUILD PARTITION p0;
+Warnings:
+Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
+Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `user_num` char(10) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
+/*!50100 PARTITION BY HASH (id)
+PARTITIONS 3 */
+DROP TABLE t1;
+# Connection default
+SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
+SET @@global.innodb_file_format = @old_innodb_file_format;
+SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
+SET @@global.innodb_file_format_max = @old_innodb_file_format_max;
SET NAMES utf8;
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
ENGINE=InnoDB
diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result
new file mode 100644
index 00000000000..97bcc11495c
--- /dev/null
+++ b/mysql-test/r/partition_myisam.result
@@ -0,0 +1,250 @@
+DROP TABLE IF EXISTS t1, t2;
+#
+# Bug#50036: Inconsistent errors when using TIMESTAMP
+# columns/expressions
+# Added test with existing TIMESTAMP partitioning (when it was allowed).
+CREATE TABLE t1 (a TIMESTAMP)
+ENGINE = MyISAM
+PARTITION BY HASH (UNIX_TIMESTAMP(a));
+INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
+SELECT * FROM t1;
+a
+2000-01-02 03:04:05
+FLUSH TABLES;
+# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
+# Disable warnings, since the result would differ when running with
+# --ps-protocol (only for the 'SELECT * FROM t1' statement).
+SELECT * FROM t1;
+a
+2000-01-02 03:04:05
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (TO_DAYS(a)) */
+INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
+SELECT * FROM t1;
+a
+2000-01-02 03:04:05
+2001-02-03 04:05:06
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+Warnings:
+Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+ALTER TABLE t1
+PARTITION BY RANGE (TO_DAYS(a))
+(PARTITION p0 VALUES LESS THAN (10000),
+PARTITION p1 VALUES LESS THAN (MAXVALUE));
+ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (TO_DAYS(a))
+PARTITIONS 3 */
+CREATE TABLE t2 LIKE t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (TO_DAYS(a))
+PARTITIONS 3 */
+Warnings:
+Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
+DROP TABLE t2;
+CREATE TABLE t2 SELECT * FROM t1;
+DROP TABLE t2;
+ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a))
+PARTITIONS 3 */
+SELECT * FROM t1;
+a
+2000-01-02 03:04:05
+2001-02-03 04:05:06
+DROP TABLE t1;
+#
+# Bug#31931: Mix of handlers error message
+#
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (a)
+( PARTITION p0 ENGINE=MyISAM,
+PARTITION p1);
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+CREATE TABLE t1 (a INT)
+PARTITION BY LIST (a)
+SUBPARTITION BY HASH (a)
+( PARTITION p0 VALUES IN (0)
+( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2),
+PARTITION p1 VALUES IN (1)
+( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM));
+ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
+#
+# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
+#
+CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
+PARTITION BY HASH (a);
+FLUSH TABLES;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error Failed to read from the .par file
+test.t1 check Error Incorrect information in file: './test/t1.frm'
+test.t1 check error Corrupt
+SELECT * FROM t1;
+ERROR HY000: Failed to read from the .par file
+# Note that it is currently impossible to drop a partitioned table
+# without the .par file
+DROP TABLE t1;
+ERROR 42S02: Unknown table 't1'
+#
+# Bug#50392: insert_id is not reset for partitioned tables
+# auto_increment on duplicate entry
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY)
+ENGINE = MyISAM;
+SET INSERT_ID= 13;
+INSERT INTO t1 VALUES (NULL);
+SET INSERT_ID= 12;
+# For transactional engines, 12 will not be inserted, since the failing
+# statement is rolled back.
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (NULL);
+# NOTE: 12 exists only in non transactional engines!
+SELECT * FROM t1;
+a
+12
+13
+14
+DROP TABLE t1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY)
+ENGINE = MyISAM
+PARTITION BY KEY(a);
+SET INSERT_ID= 13;
+INSERT INTO t1 VALUES (NULL);
+SET INSERT_ID= 12;
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (a) */
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+a
+12
+13
+14
+DROP TABLE t1;
+# Bug#30102 test
+CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (6),
+PARTITION `p1....................` VALUES LESS THAN (9),
+PARTITION p2 VALUES LESS THAN MAXVALUE);
+# List of files in database `test`, all original t1-files here
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1.frm
+t1.par
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+# Renaming to a file name where the first partition is 250 chars
+# and the second partition is 350 chars
+RENAME TABLE t1 TO `t2_new..............................................end`;
+Got one of the listed errors
+# List of files in database `test`, should not be any t2-files here
+# List of files in database `test`, should be all t1-files here
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1.frm
+t1.par
+SELECT * FROM t1;
+a
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+# List of files in database `test`, should be all t1-files here
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1.frm
+t1.par
+# Renaming to a file name where the first partition is 156 chars
+# and the second partition is 256 chars
+RENAME TABLE t1 TO `t2_............................_end`;
+Got one of the listed errors
+# List of files in database `test`, should not be any t2-files here
+# List of files in database `test`, should be all t1-files here
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
+t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
+t1#P#p2.MYD
+t1#P#p2.MYI
+t1.frm
+t1.par
+SELECT * FROM t1;
+a
+1
+10
+2
+3
+4
+5
+6
+7
+8
+9
+DROP TABLE t1;
+# Should not be any files left here
+# End of bug#30102 test.
+# Test of post-push fix for bug#11766249/59316
+CREATE TABLE t1 (a INT, b VARCHAR(255), PRIMARY KEY (a))
+ENGINE = MyISAM
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (0) MAX_ROWS=100,
+PARTITION p1 VALUES LESS THAN (100) MAX_ROWS=100,
+PARTITION pMax VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (1, "Partition p1, first row");
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_not_embedded.result b/mysql-test/r/partition_not_embedded.result
deleted file mode 100644
index c942189a956..00000000000
--- a/mysql-test/r/partition_not_embedded.result
+++ /dev/null
@@ -1,81 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-# Bug#30102 test
-CREATE TABLE t1 (a INT)
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (6),
-PARTITION `p1....................` VALUES LESS THAN (9),
-PARTITION p2 VALUES LESS THAN MAXVALUE);
-# List of files in database `test`, all original t1-files here
-t1#P#p0.MYD
-t1#P#p0.MYI
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
-t1#P#p2.MYD
-t1#P#p2.MYI
-t1.frm
-t1.par
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-# Renaming to a file name where the first partition is 250 chars
-# and the second partition is 350 chars
-RENAME TABLE t1 TO `t2_new..............................................end`;
-Got one of the listed errors
-# List of files in database `test`, should not be any t2-files here
-# List of files in database `test`, should be all t1-files here
-t1#P#p0.MYD
-t1#P#p0.MYI
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
-t1#P#p2.MYD
-t1#P#p2.MYI
-t1.frm
-t1.par
-SELECT * FROM t1;
-a
-1
-10
-2
-3
-4
-5
-6
-7
-8
-9
-# List of files in database `test`, should be all t1-files here
-t1#P#p0.MYD
-t1#P#p0.MYI
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
-t1#P#p2.MYD
-t1#P#p2.MYI
-t1.frm
-t1.par
-# Renaming to a file name where the first partition is 156 chars
-# and the second partition is 256 chars
-RENAME TABLE t1 TO `t2_............................_end`;
-Got one of the listed errors
-# List of files in database `test`, should not be any t2-files here
-# List of files in database `test`, should be all t1-files here
-t1#P#p0.MYD
-t1#P#p0.MYI
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
-t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
-t1#P#p2.MYD
-t1#P#p2.MYI
-t1.frm
-t1.par
-SELECT * FROM t1;
-a
-1
-10
-2
-3
-4
-5
-6
-7
-8
-9
-DROP TABLE t1;
-# Should not be any files left here
-# End of bug#30102 test.
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index 4280158dd16..339f2209cb3 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -13,16 +13,16 @@ EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
DROP TABLE t1;
-create table t1 (a int)
-partition by range (a)
+create table t1 (a DATETIME)
+partition by range (TO_DAYS(a))
subpartition by hash(to_seconds(a))
(partition p0 values less than (1));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) DEFAULT NULL
+ `a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE (a)
+/*!50500 PARTITION BY RANGE (TO_DAYS(a))
SUBPARTITION BY HASH (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
drop table t1;
diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result
index 60184d11d9c..f26a1642a52 100644
--- a/mysql-test/r/partition_symlink.result
+++ b/mysql-test/r/partition_symlink.result
@@ -6,11 +6,12 @@ DROP DATABASE IF EXISTS mysqltest2;
CREATE USER mysqltest_1@localhost;
CREATE DATABASE mysqltest2;
USE mysqltest2;
-CREATE TABLE t1 (a INT);
+CREATE TABLE t1 (a INT) ENGINE = MyISAM;
INSERT INTO t1 VALUES (0);
# user mysqltest_1:
USE test;
CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
@@ -47,6 +48,7 @@ DROP DATABASE mysqltest2;
CREATE DATABASE mysqltest2;
USE mysqltest2;
CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
@@ -58,6 +60,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
# user mysqltest_1:
USE test;
CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
@@ -68,6 +71,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
);
Got one of the listed errors
CREATE TABLE t1 (a INT)
+ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
@@ -82,6 +86,7 @@ DROP DATABASE mysqltest2;
USE test;
DROP USER mysqltest_1@localhost;
create table t2 (i int )
+ENGINE = MyISAM
partition by range (i)
(
partition p01 values less than (1000)
@@ -94,6 +99,7 @@ select @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
create table t1 (i int )
+ENGINE = MyISAM
partition by range (i)
(
partition p01 values less than (1000)
@@ -113,10 +119,12 @@ t2 CREATE TABLE `t2` (
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (a int)
+ENGINE = MyISAM
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
Got one of the listed errors
create table t1 (a int)
+ENGINE = MyISAM
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
new file mode 100644
index 00000000000..91a5d2d8478
--- /dev/null
+++ b/mysql-test/r/plugin_auth.result
@@ -0,0 +1,450 @@
+SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
+FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';
+PLUGIN_STATUS ACTIVE
+PLUGIN_TYPE AUTHENTICATION
+PLUGIN_DESCRIPTION plugin API test plugin
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT plugin,authentication_string FROM mysql.user WHERE User='plug';
+plugin authentication_string
+test_plugin_server plug_dest
+## test plugin auth
+ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug;
+test proxies_priv columns
+SELECT * FROM mysql.proxies_priv;
+Host User Proxied_host Proxied_user With_grant Grantor Timestamp
+xx root 1 xx
+xx root 1 xx
+xx plug % plug_dest 0 root@localhost xx
+test mysql.proxies_priv;
+SHOW CREATE TABLE mysql.proxies_priv;
+Table Create Table
+proxies_priv CREATE TABLE `proxies_priv` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `With_grant` tinyint(1) NOT NULL DEFAULT '0',
+ `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
+ KEY `Grantor` (`Grantor`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug@localhost plug_dest@%
+## test SET PASSWORD
+SET PASSWORD = PASSWORD('plug_dest');
+Warnings:
+Note 1699 SET PASSWORD has no significance for users authenticating via plugins
+## test bad credentials
+ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
+## test bad default plugin : should get CR_AUTH_PLUGIN_CANNOT_LOAD
+## test correct default plugin
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug@localhost plug@%
+## test no_auto_create_user sql mode with plugin users
+SET @@sql_mode=no_auto_create_user;
+GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server';
+SET @@sql_mode=default;
+DROP USER grant_user;
+## test utf-8 user name
+CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+GRANT PROXY ON plug_dest TO `Ÿ`;
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+Ÿ@localhost plug_dest@%
+DROP USER `Ÿ`;
+## test GRANT ... IDENTIFIED WITH/BY ...
+CREATE DATABASE test_grant_db;
+# create new user via GRANT WITH
+GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user
+IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+GRANT PROXY ON plug_dest TO new_grant_user;
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_grant_user@localhost plug_dest@%
+USE test_grant_db;
+CREATE TABLE t1 (a INT);
+DROP TABLE t1;
+REVOKE ALL PRIVILEGES ON test_grant_db.* FROM new_grant_user;
+# try re-create existing user via GRANT IDENTIFIED BY
+GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user
+IDENTIFIED BY 'unused_password';
+# make sure password doesn't take precendence
+ERROR 28000: Access denied for user 'new_grant_user'@'localhost' (using password: YES)
+#make sure plugin auth still available
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_grant_user@localhost plug_dest@%
+USE test_grant_db;
+CREATE TABLE t1 (a INT);
+DROP TABLE t1;
+DROP USER new_grant_user;
+# try re-create existing user via GRANT IDENTIFIED WITH
+GRANT ALL PRIVILEGES ON test_grant_db.* TO plug
+IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+GRANT ALL PRIVILEGES ON test_grant_db.* TO plug_dest
+IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug_dest already exists
+REVOKE SELECT on test_grant_db.* FROM joro
+INDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+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 'INDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+REVOKE SELECT on test_grant_db.* FROM joro
+INDENTIFIED BY 'plug_dest_passwd';
+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 'INDENTIFIED BY 'plug_dest_passwd'' at line 2
+REVOKE SELECT on test_grant_db.* FROM joro
+INDENTIFIED BY PASSWORD 'plug_dest_passwd';
+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 'INDENTIFIED BY PASSWORD 'plug_dest_passwd'' at line 2
+DROP DATABASE test_grant_db;
+## GRANT PROXY tests
+CREATE USER grant_plug IDENTIFIED WITH 'test_plugin_server'
+AS 'grant_plug_dest';
+CREATE USER grant_plug_dest IDENTIFIED BY 'grant_plug_dest_passwd';
+CREATE USER grant_plug_dest2 IDENTIFIED BY 'grant_plug_dest_passwd2';
+# ALL PRIVILEGES doesn't include PROXY
+GRANT ALL PRIVILEGES ON *.* TO grant_plug;
+ERROR 28000: Access denied for user 'grant_plug'@'localhost' (using password: YES)
+GRANT ALL PRIVILEGES,PROXY ON grant_plug_dest TO grant_plug;
+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 'PROXY ON grant_plug_dest TO grant_plug' at line 1
+this should fail : can't combine PROXY
+GRANT ALL SELECT,PROXY ON grant_plug_dest TO grant_plug;
+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,PROXY ON grant_plug_dest TO grant_plug' at line 1
+# this should fail : no such grant
+REVOKE PROXY ON grant_plug_dest FROM grant_plug;
+ERROR 42000: There is no such grant defined for user 'grant_plug' on host '%'
+in grant_plug_dest_con
+## testing what an ordinary user can grant
+this should fail : no rights to grant all
+GRANT PROXY ON ''@'' TO grant_plug;
+ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
+this should fail : not the same user
+GRANT PROXY ON grant_plug TO grant_plug_dest;
+ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
+this should fail : same user, but on a different host
+GRANT PROXY ON grant_plug_dest TO grant_plug;
+ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
+this should work : same user
+GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2;
+REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2;
+this should work : same user
+GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION;
+REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug;
+this should fail : can't create users
+GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost;
+ERROR 42000: You are not allowed to create a user with GRANT
+in default connection
+# test what root can grant
+should work : root has PROXY to all users
+GRANT PROXY ON ''@'' TO grant_plug;
+REVOKE PROXY ON ''@'' FROM grant_plug;
+should work : root has PROXY to all users
+GRANT PROXY ON ''@'' TO proxy_admin IDENTIFIED BY 'test'
+WITH GRANT OPTION;
+need USAGE : PROXY doesn't contain it.
+GRANT USAGE on *.* TO proxy_admin;
+in proxy_admin_con;
+should work : proxy_admin has proxy to ''@''
+GRANT PROXY ON future_user TO grant_plug;
+in default connection
+SHOW GRANTS FOR grant_plug;
+Grants for grant_plug@%
+GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' WITH GRANT OPTION
+GRANT PROXY ON 'future_user'@'%' TO 'grant_plug'@'%'
+REVOKE PROXY ON future_user FROM grant_plug;
+SHOW GRANTS FOR grant_plug;
+Grants for grant_plug@%
+GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' WITH GRANT OPTION
+## testing drop user
+CREATE USER test_drop@localhost;
+GRANT PROXY ON future_user TO test_drop@localhost;
+SHOW GRANTS FOR test_drop@localhost;
+Grants for test_drop@localhost
+GRANT USAGE ON *.* TO 'test_drop'@'localhost'
+GRANT PROXY ON 'future_user'@'%' TO 'test_drop'@'localhost'
+DROP USER test_drop@localhost;
+SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost';
+Host User Proxied_host Proxied_user With_grant Grantor Timestamp
+DROP USER proxy_admin;
+DROP USER grant_plug,grant_plug_dest,grant_plug_dest2;
+## END GRANT PROXY tests
+## cleanup
+DROP USER plug;
+DROP USER plug_dest;
+## @@proxy_user tests
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug;
+SELECT USER(),CURRENT_USER(),@@LOCAL.proxy_user;
+USER() CURRENT_USER() @@LOCAL.proxy_user
+root@localhost root@localhost NULL
+SELECT @@GLOBAL.proxy_user;
+ERROR HY000: Variable 'proxy_user' is a SESSION variable
+SELECT @@LOCAL.proxy_user;
+@@LOCAL.proxy_user
+NULL
+SET GLOBAL proxy_user = 'test';
+ERROR HY000: Variable 'proxy_user' is a read only variable
+SET LOCAL proxy_user = 'test';
+ERROR HY000: Variable 'proxy_user' is a read only variable
+SELECT @@LOCAL.proxy_user;
+@@LOCAL.proxy_user
+NULL
+# in connection plug_con
+SELECT @@LOCAL.proxy_user;
+@@LOCAL.proxy_user
+'plug'@'%'
+# in connection default
+## cleanup
+DROP USER plug;
+DROP USER plug_dest;
+## END @@proxy_user tests
+## @@external_user tests
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug;
+SELECT USER(),CURRENT_USER(),@@LOCAL.external_user;
+USER() CURRENT_USER() @@LOCAL.external_user
+root@localhost root@localhost NULL
+SELECT @@GLOBAL.external_user;
+ERROR HY000: Variable 'external_user' is a SESSION variable
+SELECT @@LOCAL.external_user;
+@@LOCAL.external_user
+NULL
+SET GLOBAL external_user = 'test';
+ERROR HY000: Variable 'external_user' is a read only variable
+SET LOCAL external_user = 'test';
+ERROR HY000: Variable 'external_user' is a read only variable
+SELECT @@LOCAL.external_user;
+@@LOCAL.external_user
+NULL
+# in connection plug_con
+SELECT @@LOCAL.external_user;
+@@LOCAL.external_user
+'plug'@'%'
+# in connection default
+## cleanup
+DROP USER plug;
+DROP USER plug_dest;
+## END @@external_user tests
+#
+# Bug #56798 : Wrong credentials assigned when using a proxy user.
+#
+GRANT ALL PRIVILEGES ON *.* TO power_user;
+GRANT USAGE ON anonymous_db.* TO ''@''
+ IDENTIFIED WITH 'test_plugin_server' AS 'power_user';
+GRANT PROXY ON power_user TO ''@'';
+CREATE DATABASE confidential_db;
+SELECT user(),current_user(),@@proxy_user;
+user() current_user() @@proxy_user
+test_login_user@localhost power_user@% ''@''
+DROP USER power_user;
+DROP USER ''@'';
+DROP DATABASE confidential_db;
+# Test case #2 (crash with double grant proxy)
+CREATE USER ''@'' IDENTIFIED WITH 'test_plugin_server' AS 'standard_user';
+CREATE USER standard_user;
+CREATE DATABASE shared;
+GRANT ALL PRIVILEGES ON shared.* TO standard_user;
+GRANT PROXY ON standard_user TO ''@'';
+#should not crash
+GRANT PROXY ON standard_user TO ''@'';
+DROP USER ''@'';
+DROP USER standard_user;
+DROP DATABASE shared;
+#
+# Bug #57551 : Live upgrade fails between 5.1.52 -> 5.5.7-rc
+#
+CALL mtr.add_suppression("Missing system table mysql.proxies_priv.");
+DROP TABLE mysql.proxies_priv;
+# Must come back with mysql.proxies_priv absent.
+SELECT * FROM mysql.proxies_priv;
+ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+CREATE USER u1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
+REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
+CREATE USER u2@localhost;
+GRANT ALL PRIVILEGES ON *.* TO u2@localhost;
+# access denied because of no privileges to root
+GRANT PROXY ON u2@localhost TO u1@localhost;
+ERROR 28000: Access denied for user 'root'@'localhost'
+# access denied because of no privileges to root
+REVOKE PROXY ON u2@localhost FROM u1@localhost;
+ERROR 28000: Access denied for user 'root'@'localhost'
+# go try graning proxy on itself, so that it will need the table
+GRANT PROXY ON u2@localhost TO u1@localhost;
+ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+REVOKE PROXY ON u2@localhost FROM u1@localhost;
+ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
+# test if REVOKE works without the proxies_priv table
+REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost, u2@localhost;
+# test if DROP USER work without the proxies_priv table
+DROP USER u1@localhost,u2@localhost;
+# test if FLUSH PRIVILEGES works without the proxies_priv table
+FLUSH PRIVILEGES;
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.general_log OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.servers OK
+mysql.slow_log OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+SELECT Host,User,Proxied_host,Proxied_user,With_grant FROM mysql.proxies_priv;
+Host localhost
+User root
+Proxied_host
+Proxied_user
+With_grant 1
+FLUSH PRIVILEGES;
+#
+# Bug#58139 : default-auth option not recognized in MySQL standard
+# command line clients
+#
+# Executing 'mysql'
+1
+1
+# Executing 'mysqladmin'
+mysqld is alive
+# Executing 'mysqldump'
+# Executing 'mysql_upgrade'
+The --upgrade-system-tables option was used, databases won't be touched.
+#
+# Bug #59657: Move the client authentication_pam plugin into the
+# server repository
+#
+CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server'
+ AS 'cleartext_test';
+## test plugin auth
+ERROR 28000: Access denied for user 'uplain'@'localhost' (using password: YES)
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+uplain@localhost uplain@localhost
+DROP USER uplain@localhost;
+#
+# Bug #59038 : mysql.user.authentication_string column
+# causes configuration wizard to fail
+INSERT INTO mysql.user(
+Host,
+User,
+Password,
+Select_priv,
+Insert_priv,
+Update_priv,
+Delete_priv,
+Create_priv,
+Drop_priv,
+Reload_priv,
+Shutdown_priv,
+Process_priv,
+File_priv,
+Grant_priv,
+References_priv,
+Index_priv,
+Alter_priv,
+Show_db_priv,
+Super_priv,
+Create_tmp_table_priv,
+Lock_tables_priv,
+Execute_priv,
+Repl_slave_priv,
+Repl_client_priv,
+/*!50001
+Create_view_priv,
+Show_view_priv,
+Create_routine_priv,
+Alter_routine_priv,
+Create_user_priv,
+*/
+ssl_type,
+ssl_cipher,
+x509_issuer,
+x509_subject,
+max_questions,
+max_updates,
+max_connections)
+VALUES (
+'localhost',
+'inserttest', '',
+'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
+'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
+/*!50001 'Y', 'Y', 'Y', 'Y', 'Y', */'', '', '', '', '0', '0', '0');
+FLUSH PRIVILEGES;
+DROP USER inserttest@localhost;
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE
+COLUMN_NAME IN ('authentication_string', 'plugin') AND
+TABLE_NAME='user' AND
+TABLE_SCHEMA='mysql'
+ORDER BY COLUMN_NAME;
+IS_NULLABLE COLUMN_NAME
+YES authentication_string
+YES plugin
+#
+# Bug #11936829: diff. between mysql.user (authentication_string)
+# in fresh and upgraded 5.5.11
+#
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
+COLUMN_NAME IN ('plugin', 'authentication_string')
+ORDER BY COLUMN_NAME;
+IS_NULLABLE COLUMN_NAME
+YES authentication_string
+YES plugin
+ALTER TABLE mysql.user MODIFY plugin char(64) DEFAULT '' NOT NULL;
+ALTER TABLE mysql.user MODIFY authentication_string TEXT NOT NULL;
+Run mysql_upgrade on a 5.5.10 external authentication column layout
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.general_log OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.servers OK
+mysql.slow_log OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
+COLUMN_NAME IN ('plugin', 'authentication_string')
+ORDER BY COLUMN_NAME;
+IS_NULLABLE COLUMN_NAME
+YES authentication_string
+YES plugin
+End of 5.5 tests
diff --git a/mysql-test/r/plugin_auth_qa.result b/mysql-test/r/plugin_auth_qa.result
new file mode 100644
index 00000000000..d1128cf04ee
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa.result
@@ -0,0 +1,327 @@
+CREATE DATABASE test_user_db;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+========== test 1.1 ======================================================
+CREATE USER plug IDENTIFIED WITH test_plugin_server;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+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 'plug_dest' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
+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 'plug_dest' at line 1
+========== test 1.1 syntax errors ========================================
+CREATE USER plug IDENTIFIED WITH AS plug_dest;
+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 'AS plug_dest' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
+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 'AS plug_dest' at line 1
+CREATE USER plug IDENTIFIED WITH;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+CREATE USER plug IDENTIFIED AS '';
+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 'AS ''' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
+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 'AS ''' at line 1
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+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 'IDENTIFIED WITH 'test_plugin_server'' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug
+IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
+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 'IDENTIFIED WITH 'test_plugin_server'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
+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 'AS 'plug_dest'' at line 1
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
+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 'AS '' AS 'plug_dest'' at line 1
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ''
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+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 'IDENTIFIED WITH test_plugin_server AS 'plug_dest'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+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 'IDENTIFIED WITH test_plugin_server AS 'plug_dest'' at line 2
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'
+IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+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 'IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
+ IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+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 'IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'USER plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ USER plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'USER plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ plug_dest IDENTIFIED by 'plug_dest_pwd';
+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 'plug_dest IDENTIFIED by 'plug_dest_pwd'' at line 2
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+IDENTIFIED by 'plug_dest_pwd';
+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 'IDENTIFIED by 'plug_dest_pwd'' at line 2
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
+ IDENTIFIED by 'plug_dest_pwd';
+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 'IDENTIFIED by 'plug_dest_pwd'' at line 2
+========== test 1.1 combinations ==========================
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+========== test 1.1.1.6/1.1.2.5 ============================
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+plug_dest NULL
+DROP USER plug, plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest NULL
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+plug_dest NULL
+DROP USER plug, plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+DROP USER plug;
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest NULL
+DROP USER plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+plug_dest NULL
+DROP USER plug, plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plug_dest
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest NULL
+DROP USER plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
+ERROR HY000: GRANT with IDENTIFIED WITH is illegal because the user plug already exists
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest *939AEE68989794C0F408277411C26055CDF41119
+DROP USER plug;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
+ERROR HY000: Operation CREATE USER failed for 'plug'@'%'
+DROP USER plug;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+plug_dest test_plugin_server plug_dest
+DROP USER plug,plug_dest;
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+plug test_plugin_server plug_dest
+plug_dest test_plugin_server plug_dest
+DROP USER plug,plug_dest;
+========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
+SET NAMES utf8;
+CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg test_plugin_server plüg_dest
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest NULL
+DROP USER plüg_dest;
+SET NAMES ascii;
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+pl??g test_plugin_server pl??g_dest
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+pl??g_dest NULL
+DROP USER 'plüg_dest';
+SET NAMES latin1;
+========== test 1.1.1.5 ====================================
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+ERROR HY000: Plugin 'test_plügin_server' is not loaded
+CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server plüg_dest
+DROP USER 'plug';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest NULL
+DROP USER 'plüg_dest';
+SET NAMES utf8;
+CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
+ERROR HY000: Plugin 'test_plügin_server' is not loaded
+CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg test_plugin_server plüg_dest
+DROP USER 'plüg';
+CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest NULL
+DROP USER 'plüg_dest';
+CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg test_plugin_server plüg_dest
+DROP USER plüg;
+CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plüg_dest NULL
+DROP USER plüg_dest;
+========== test 1.1.1.2/1.1.2.2=============================
+SET @auth_name= 'test_plugin_server';
+CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
+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 '@auth_name AS 'plug_dest'' at line 1
+SET @auth_string= 'plug_dest';
+CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
+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 '@auth_string' at line 1
+========== test 1.1.1.3/1.1.2.3=============================
+CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
+ERROR HY000: Plugin 'hh's_test_plugin_server' is not loaded
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug test_plugin_server hh's_plug_dest
+DROP USER plug;
+CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+hh's_plug_dest NULL
+DROP USER 'hh''s_plug_dest';
+========== test 1.1.1.4 ====================================
+CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
+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 '''s_test_plugin_server AS 'plug_dest'' at line 1
+========== test 1.1.3.1 ====================================
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+plug_dest NULL
+DROP USER grant_user,plug_dest;
+set @save_sql_mode= @@sql_mode;
+SET @@sql_mode=no_auto_create_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+CREATE USER plug_dest;
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
+ERROR 42000: Can't find any matching row in the user table
+DROP USER grant_user;
+GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+grant_user test_plugin_server plug_dest
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+grant_user test_plugin_server plug_dest
+plug_dest NULL *939AEE68989794C0F408277411C26055CDF41119
+DROP USER plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+grant_user test_plugin_server plug_dest
+plug_dest NULL *560881EB651416CEF77314D07D55EDCD5FC1BD6D
+DROP USER grant_user,plug_dest;
+set @@sql_mode= @save_sql_mode;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_auth_qa_1.result b/mysql-test/r/plugin_auth_qa_1.result
new file mode 100644
index 00000000000..51c7260d9ae
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa_1.result
@@ -0,0 +1,335 @@
+CREATE DATABASE test_user_db;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+========== test 1.1.3.2 ====================================
+CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE PROXY ON plug_dest FROM plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+DROP USER plug_user,plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest NULL
+plug_user test_plugin_server plug_dest
+1)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+2)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE PROXY ON plug_dest FROM plug_user;
+3)
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+DROP USER plug_user,plug_dest;
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+1)
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug_user;
+2)
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+Tables_in_test_user_db
+t1
+REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user'
+ IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+DROP USER plug_user,plug_dest;
+========== test 1.2 ========================================
+GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+RENAME USER plug_dest TO new_dest;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON new_dest TO plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest NULL
+plug_user test_plugin_server plug_dest
+DROP USER plug_user,new_dest;
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug_user;
+current_user()
+plug_dest@%
+user()
+plug_user@localhost
+RENAME USER plug_dest TO new_dest;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+GRANT PROXY ON new_dest TO plug_user;
+ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest NULL
+plug_user test_plugin_server plug_dest
+DROP USER plug_user,new_dest;
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug_user@localhost plug_dest@%
+connection default;
+disconnect plug_user;
+RENAME USER plug_user TO new_user;
+connect(plug_user,localhost,new_user,plug_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_user@localhost plug_dest@%
+connection default;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user test_plugin_server plug_dest
+plug_dest NULL
+disconnect plug_user;
+UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest NULL
+plug_user test_plugin_server plug_dest
+DROP USER plug_dest,plug_user;
+========== test 1.3 ========================================
+CREATE USER plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+connect(plug_user,localhost,plug_user,plug_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug_user@localhost plug_dest@%
+connection default;
+disconnect plug_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+plug_dest NULL
+plug_user test_plugin_server plug_dest
+UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user test_plugin_server plug_dest
+plug_dest NULL
+UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user test_plugin_server new_dest
+plug_dest NULL
+UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
+FLUSH PRIVILEGES;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_user new_plugin_server new_dest
+plug_dest NULL
+connect(plug_user,localhost,new_user,new_dest);
+ERROR HY000: Plugin 'new_plugin_server' is not loaded
+UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
+UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
+FLUSH PRIVILEGES;
+GRANT PROXY ON new_dest TO new_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest NULL
+new_user test_plugin_server new_dest
+connect(plug_user,localhost,new_user,new_dest);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_user@localhost new_dest@%
+connection default;
+disconnect plug_user;
+UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
+FLUSH PRIVILEGES;
+CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+new_dest NULL
+new_user test_plugin_server new_dest
+plug_dest NULL
+GRANT ALL PRIVILEGES ON test.* TO new_user;
+connect(plug_user,localhost,new_dest,new_dest_passwd);
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+new_dest@localhost new_dest@%
+connection default;
+disconnect plug_user;
+DROP USER new_user,new_dest,plug_dest;
+========== test 2, 2.1, 2.2 ================================
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+ test_plugin_server proxied_user
+proxied_user NULL
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
+GRANT PROXY ON proxied_user TO ''@'';
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxy_user@localhost proxied_user@%
+========== test 2.2.1 ======================================
+SELECT @@proxy_user;
+@@proxy_user
+''@''
+connection default;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@''
+IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+ test_plugin_server proxied_user
+proxied_user NULL
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES)
+GRANT PROXY ON proxied_user TO ''@'';
+connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user@localhost proxied_user@%
+connection default;
+disconnect proxy_con;
+connect(proxy_con,localhost,proxy_user,proxied_user);
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxy_user@localhost proxied_user@%
+SELECT @@proxy_user;
+@@proxy_user
+''@''
+connection default;
+disconnect proxy_con;
+DROP USER ''@'',proxied_user;
+CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
+CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
+CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
+CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
+CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
+CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
+GRANT PROXY ON proxied_user_1 TO ''@'';
+GRANT PROXY ON proxied_user_2 TO ''@'';
+GRANT PROXY ON proxied_user_3 TO ''@'';
+GRANT PROXY ON proxied_user_4 TO ''@'';
+GRANT PROXY ON proxied_user_5 TO ''@'';
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+ test_plugin_server proxied_user
+proxied_user_1 NULL
+proxied_user_2 NULL
+proxied_user_3 NULL
+proxied_user_4 NULL
+proxied_user_5 NULL
+connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
+connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
+connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
+connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
+connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
+connection proxy_con_1;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_1@localhost proxied_user_1@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_2;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_2@localhost proxied_user_2@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_3;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_3@localhost proxied_user_3@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_4;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_4@localhost proxied_user_4@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection proxy_con_5;
+SELECT USER(),CURRENT_USER();
+USER() CURRENT_USER()
+proxied_user_5@localhost proxied_user_5@%
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+connection default;
+disconnect proxy_con_1;
+disconnect proxy_con_2;
+disconnect proxy_con_3;
+disconnect proxy_con_4;
+disconnect proxy_con_5;
+DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
+========== test 3 ==========================================
+GRANT ALL PRIVILEGES ON *.* TO plug_user
+IDENTIFIED WITH test_plugin_server AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+GRANT PROXY ON plug_dest TO plug_user;
+FLUSH PRIVILEGES;
+DROP USER plug_user, plug_dest;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_auth_qa_2.result b/mysql-test/r/plugin_auth_qa_2.result
new file mode 100644
index 00000000000..f4706e5aa0b
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa_2.result
@@ -0,0 +1,150 @@
+CREATE DATABASE test_user_db;
+========== test 1.1.3.2 ====================================
+=== check contens of components of info ====================
+CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest';
+CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+qa_test_1_dest NULL
+qa_test_1_user qa_auth_interface qa_test_1_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_1_user@% qa_test_1_user@localhost NULL NULL
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+qa_test_1_dest NULL
+qa_test_1_user qa_auth_interface qa_test_1_dest
+DROP USER qa_test_1_user;
+DROP USER qa_test_1_dest;
+=== Assign values to components of info ====================
+CREATE USER qa_test_2_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_2_dest';
+CREATE USER qa_test_2_dest IDENTIFIED BY 'dest_passwd';
+CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
+GRANT PROXY ON authenticated_as TO qa_test_2_user;
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+authenticated_as NULL
+qa_test_2_dest NULL
+qa_test_2_user qa_auth_interface qa_test_2_dest
+SELECT @@proxy_user;
+@@proxy_user
+NULL
+SELECT @@external_user;
+@@external_user
+NULL
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' 'qa_test_2_user'@'%'
+SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
+user plugin authentication_string
+authenticated_as NULL
+qa_test_2_dest NULL
+qa_test_2_user qa_auth_interface qa_test_2_dest
+DROP USER qa_test_2_user;
+DROP USER qa_test_2_dest;
+DROP USER authenticated_as;
+=== Assign too high values for *length, which should have no effect ====
+CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest';
+CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' 'qa_test_3_user'@'%'
+DROP USER qa_test_3_user;
+DROP USER qa_test_3_dest;
+=== Assign too low values for *length, which should have no effect ====
+CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest';
+CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' 'qa_test_4_user'@'%'
+DROP USER qa_test_4_user;
+DROP USER qa_test_4_dest;
+=== Assign empty string especially to authenticated_as (in plugin) ====
+CREATE USER qa_test_5_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_5_dest';
+CREATE USER qa_test_5_dest IDENTIFIED BY 'dest_passwd';
+CREATE USER ''@'localhost' IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_5_dest identified by 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_passwd';
+GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
+GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
+SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
+user plugin authentication_string password
+ NULL *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_5_dest NULL *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_5_user qa_auth_interface qa_test_5_dest
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES)
+DROP USER qa_test_5_user;
+DROP USER qa_test_5_dest;
+DROP USER ''@'localhost';
+=== Assign 'root' especially to authenticated_as (in plugin) ====
+CREATE USER qa_test_6_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
+CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+user plugin authentication_string password
+qa_test_6_dest NULL *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_6_user qa_auth_interface qa_test_6_dest
+root
+root
+root
+root
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES)
+GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+user plugin authentication_string password
+qa_test_6_dest NULL *DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_6_user qa_auth_interface qa_test_6_dest
+root
+root
+root
+root
+root qa_auth_interface qa_test_6_dest
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+REVOKE PROXY ON qa_test_6_dest FROM root;
+SELECT user,plugin,authentication_string FROM mysql.user;
+user plugin authentication_string
+qa_test_6_dest NULL
+qa_test_6_user qa_auth_interface qa_test_6_dest
+root
+root
+root
+root
+root qa_auth_interface qa_test_6_dest
+exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+DROP USER qa_test_6_user;
+DROP USER qa_test_6_dest;
+DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
+SELECT user,plugin,authentication_string,password FROM mysql.user;
+user plugin authentication_string password
+root
+root
+root
+root
+=== Test of the --default_auth option for clients ====
+CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
+CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
+exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_11_user'@'localhost' (using password: YES)
+DROP USER qa_test_11_user, qa_test_11_dest;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_auth_qa_3.result b/mysql-test/r/plugin_auth_qa_3.result
new file mode 100644
index 00000000000..d94d8879e7d
--- /dev/null
+++ b/mysql-test/r/plugin_auth_qa_3.result
@@ -0,0 +1,11 @@
+CREATE DATABASE test_user_db;
+CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
+GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
+GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
+exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+current_user() user() @@local.proxy_user @@local.external_user
+qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%'
+exec MYSQL PLUGIN_AUTH_OPT --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
+ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO)
+DROP USER qa_test_11_user, qa_test_11_dest;
+DROP DATABASE test_user_db;
diff --git a/mysql-test/r/plugin_load_option.result b/mysql-test/r/plugin_load_option.result
new file mode 100644
index 00000000000..fec41bac8e6
--- /dev/null
+++ b/mysql-test/r/plugin_load_option.result
@@ -0,0 +1,7 @@
+UNINSTALL PLUGIN example;
+ERROR HY000: Plugin 'example' is force_plus_permanent and can not be unloaded
+SELECT PLUGIN_NAME, PLUGIN_STATUS, LOAD_OPTION FROM INFORMATION_SCHEMA.PLUGINS
+WHERE PLUGIN_NAME IN ('MyISAM', 'EXAMPLE');
+PLUGIN_NAME PLUGIN_STATUS LOAD_OPTION
+MyISAM ACTIVE FORCE
+EXAMPLE ACTIVE FORCE_PLUS_PERMANENT
diff --git a/mysql-test/r/plugin_not_embedded.result b/mysql-test/r/plugin_not_embedded.result
index 82cfe7b23b8..27553366660 100644
--- a/mysql-test/r/plugin_not_embedded.result
+++ b/mysql-test/r/plugin_not_embedded.result
@@ -8,3 +8,5 @@ ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plu
GRANT DELETE ON mysql.plugin TO bug51770@localhost;
UNINSTALL PLUGIN example;
DROP USER bug51770@localhost;
+INSTALL PLUGIN example SONAME '../ha_example.so';
+ERROR HY000: No paths allowed for shared library
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 48a995f1b10..fb6951f49fd 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -3046,6 +3046,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+
End of 5.1 tests.
#
@@ -3204,6 +3205,510 @@ test1
DROP PROCEDURE p1;
DROP PROCEDURE p2;
+TINYINT
+
+CREATE PROCEDURE p1(OUT v TINYINT)
+SET v = 127;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 127;
+@a @a = 127
+127 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+SMALLINT
+
+CREATE PROCEDURE p1(OUT v SMALLINT)
+SET v = 32767;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 32767;
+@a @a = 32767
+32767 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+MEDIUMINT
+
+CREATE PROCEDURE p1(OUT v MEDIUMINT)
+SET v = 8388607;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 8388607;
+@a @a = 8388607
+8388607 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+INT
+
+CREATE PROCEDURE p1(OUT v INT)
+SET v = 2147483647;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 2147483647;
+@a @a = 2147483647
+2147483647 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BIGINT
+
+CREATE PROCEDURE p1(OUT v BIGINT)
+SET v = 9223372036854775807;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 9223372036854775807;
+@a @a = 9223372036854775807
+9223372036854775807 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BIT(11)
+
+CREATE PROCEDURE p1(OUT v BIT(11))
+SET v = b'10100100101';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = b'10100100101';
+@a @a = b'10100100101'
+1317 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TIMESTAMP
+
+CREATE PROCEDURE p1(OUT v TIMESTAMP)
+SET v = '2007-11-18 15:01:02';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '2007-11-18 15:01:02';
+@a @a = '2007-11-18 15:01:02'
+2007-11-18 15:01:02 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DATETIME
+
+CREATE PROCEDURE p1(OUT v DATETIME)
+SET v = '1234-11-12 12:34:59';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '1234-11-12 12:34:59';
+@a @a = '1234-11-12 12:34:59'
+1234-11-12 12:34:59 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TIME
+
+CREATE PROCEDURE p1(OUT v TIME)
+SET v = '123:45:01';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '123:45:01';
+@a @a = '123:45:01'
+123:45:01 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DATE
+
+CREATE PROCEDURE p1(OUT v DATE)
+SET v = '1234-11-12';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = '1234-11-12';
+@a @a = '1234-11-12'
+1234-11-12 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+YEAR
+
+CREATE PROCEDURE p1(OUT v YEAR)
+SET v = 2010;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 2010;
+@a @a = 2010
+2010 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+FLOAT(7, 4)
+
+CREATE PROCEDURE p1(OUT v FLOAT(7, 4))
+SET v = 123.4567;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a - 123.4567 < 0.00001;
+@a @a - 123.4567 < 0.00001
+123.45670318603516 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DOUBLE(8, 5)
+
+CREATE PROCEDURE p1(OUT v DOUBLE(8, 5))
+SET v = 123.45678;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a - 123.45678 < 0.000001;
+@a @a - 123.45678 < 0.000001
+123.45678 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+DECIMAL(9, 6)
+
+CREATE PROCEDURE p1(OUT v DECIMAL(9, 6))
+SET v = 123.456789;
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 123.456789;
+@a @a = 123.456789
+123.456789 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+CHAR(32)
+
+CREATE PROCEDURE p1(OUT v CHAR(32))
+SET v = REPEAT('a', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('a', 16);
+@a @a = REPEAT('a', 16)
+aaaaaaaaaaaaaaaa 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+VARCHAR(32)
+
+CREATE PROCEDURE p1(OUT v VARCHAR(32))
+SET v = REPEAT('b', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('b', 16);
+@a @a = REPEAT('b', 16)
+bbbbbbbbbbbbbbbb 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TINYTEXT
+
+CREATE PROCEDURE p1(OUT v TINYTEXT)
+SET v = REPEAT('c', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('c', 16);
+@a @a = REPEAT('c', 16)
+cccccccccccccccc 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TEXT
+
+CREATE PROCEDURE p1(OUT v TEXT)
+SET v = REPEAT('d', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('d', 16);
+@a @a = REPEAT('d', 16)
+dddddddddddddddd 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+MEDIUMTEXT
+
+CREATE PROCEDURE p1(OUT v MEDIUMTEXT)
+SET v = REPEAT('e', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('e', 16);
+@a @a = REPEAT('e', 16)
+eeeeeeeeeeeeeeee 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+LONGTEXT
+
+CREATE PROCEDURE p1(OUT v LONGTEXT)
+SET v = REPEAT('f', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('f', 16);
+@a @a = REPEAT('f', 16)
+ffffffffffffffff 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BINARY(32)
+
+CREATE PROCEDURE p1(OUT v BINARY(32))
+SET v = REPEAT('g', 32);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('g', 32);
+@a @a = REPEAT('g', 32)
+gggggggggggggggggggggggggggggggg 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+VARBINARY(32)
+
+CREATE PROCEDURE p1(OUT v VARBINARY(32))
+SET v = REPEAT('h', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('h', 16);
+@a @a = REPEAT('h', 16)
+hhhhhhhhhhhhhhhh 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+TINYBLOB
+
+CREATE PROCEDURE p1(OUT v TINYBLOB)
+SET v = REPEAT('i', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('i', 16);
+@a @a = REPEAT('i', 16)
+iiiiiiiiiiiiiiii 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+BLOB
+
+CREATE PROCEDURE p1(OUT v BLOB)
+SET v = REPEAT('j', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('j', 16);
+@a @a = REPEAT('j', 16)
+jjjjjjjjjjjjjjjj 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+MEDIUMBLOB
+
+CREATE PROCEDURE p1(OUT v MEDIUMBLOB)
+SET v = REPEAT('k', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('k', 16);
+@a @a = REPEAT('k', 16)
+kkkkkkkkkkkkkkkk 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+LONGBLOB
+
+CREATE PROCEDURE p1(OUT v LONGBLOB)
+SET v = REPEAT('l', 16);
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = REPEAT('l', 16);
+@a @a = REPEAT('l', 16)
+llllllllllllllll 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+SET('aaa', 'bbb')
+
+CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb'))
+SET v = 'aaa';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 'aaa';
+@a @a = 'aaa'
+aaa 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
+ENUM('aaa', 'bbb')
+
+CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb'))
+SET v = 'aaa';
+PREPARE stmt1 FROM 'CALL p1(?)';
+EXECUTE stmt1 USING @a;
+CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
+SHOW CREATE TABLE tmp1;
+Table Create Table
+tmp1 CREATE TEMPORARY TABLE `tmp1` (
+ `c1` longblob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT @a, @a = 'aaa';
+@a @a = 'aaa'
+aaa 1
+DROP TEMPORARY TABLE tmp1;
+DROP PROCEDURE p1;
+
# End of WL#4435.
#
# WL#4284: Transactional DDL locking
@@ -3229,5 +3734,19 @@ CREATE TABLE t1 (a INT);
BEGIN;
PREPARE stmt1 FROM "SELECT * FROM t1";
DROP TABLE t1;
+
+#
+# Bug#56115: invalid memory reads when PS selecting from
+# information_schema tables
+# Bug#58701: crash in Field::make_field, cursor-protocol
+#
+# NOTE: MTR should be run both with --ps-protocol and --cursor-protocol.
+#
+
+SELECT *
+FROM (SELECT 1 UNION SELECT 2) t;
+1
+1
+2
#
-# End of 6.0 tests.
+# End of 5.5 tests.
diff --git a/mysql-test/r/query_cache_28249.result b/mysql-test/r/query_cache_28249.result
index aed84911032..72d713e8e70 100644
--- a/mysql-test/r/query_cache_28249.result
+++ b/mysql-test/r/query_cache_28249.result
@@ -8,7 +8,7 @@ SET @query_cache_size= @@global.query_cache_size;
SET GLOBAL query_cache_type=1;
SET GLOBAL query_cache_limit=10000;
SET GLOBAL query_cache_min_res_unit=0;
-SET GLOBAL query_cache_size= 100000;
+SET GLOBAL query_cache_size= 102400;
FLUSH TABLES;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT);
@@ -23,10 +23,10 @@ SELECT *, (SELECT COUNT(*) FROM t2) FROM t1;
# Switch to connection user3
# Poll till the select of connection user1 is blocked by the write lock on t1.
SELECT user,command,state,info FROM information_schema.processlist
-WHERE state = 'Locked'
+WHERE state = 'Waiting for table metadata lock'
AND info = 'SELECT *, (SELECT COUNT(*) FROM t2) FROM t1';
user command state info
-root Query Locked SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
+root Query Waiting for table metadata lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
INSERT INTO t1 VALUES (4);
# Switch to connection user2
UNLOCK TABLES;
diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result
index 80c21add075..ec78fe65802 100644
--- a/mysql-test/r/query_cache_debug.result
+++ b/mysql-test/r/query_cache_debug.result
@@ -5,20 +5,24 @@ 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,foobar,wait_in_query_cache_insert';
+set debug_sync="wait_in_query_cache_insert SIGNAL parked WAIT_FOR go";
select SQL_CACHE * from t1;;
+set debug_sync="now WAIT_FOR parked";
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;
+set debug_sync="now SIGNAL go";
Show query cache status.
show status like 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
+a
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+set debug_sync= 'RESET';
set global query_cache_size= 0;
use test;
drop table t1;
@@ -32,11 +36,12 @@ SET GLOBAL concurrent_insert= 1;
SET GLOBAL query_cache_size= 1024*512;
SET GLOBAL query_cache_type= ON;
# Switch to connection con1
-SET SESSION debug='+d,foobar,wait_after_query_cache_invalidate';
+SET DEBUG_SYNC = "wait_after_query_cache_invalidate SIGNAL parked WAIT_FOR go";
# Send concurrent insert, will wait in the query cache table invalidate
INSERT INTO t1 VALUES (4);
# Switch to connection default
# Wait for concurrent insert to reach the debug point
+SET DEBUG_SYNC = "now WAIT_FOR parked";
# Switch to connection con2
# Send SELECT that shouldn't be cached
SELECT * FROM t1;
@@ -46,9 +51,7 @@ a
3
# Switch to connection default
# Notify the concurrent insert to proceed
-SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE STATE = 'wait_after_query_cache_invalidate' INTO @thread_id;
-KILL QUERY @thread_id;
+SET DEBUG_SYNC = "now SIGNAL go";
# Switch to connection con1
# Gather insert result
SHOW STATUS LIKE "Qcache_queries_in_cache";
@@ -66,6 +69,7 @@ Variable_name Value
Qcache_queries_in_cache 1
# Disconnect
# Restore defaults
+SET DEBUG_SYNC= 'RESET';
RESET QUERY CACHE;
DROP TABLE t1,t2;
SET GLOBAL concurrent_insert= DEFAULT;
@@ -108,43 +112,50 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
** before the mutex lock in invalidate_table_internal.
** This will allow new result sets to be written into the QC.
**
-SET SESSION debug='+d,foobar,wait_in_query_cache_invalidate1';
-SET SESSION debug='+d,foobar,wait_in_query_cache_invalidate2';
+SET DEBUG_SYNC="wait_in_query_cache_invalidate1 SIGNAL parked1_1 WAIT_FOR go1_1";
+SET DEBUG_SYNC="wait_in_query_cache_invalidate2 SIGNAL parked1_2 WAIT_FOR go1_2";
DELETE FROM t1 WHERE a like '%a%';;
=================================== Connection default
** Assert that the expect process status is obtained.
+SET DEBUG_SYNC="now WAIT_FOR parked1_1";
**
=================================== Connection thd2
** On THD2: Insert a result into the cache. This attempt will be blocked
** because of a debug hook placed just before the mutex lock after which
** the first part of the result set is written.
-SET SESSION debug='+d,foobar,wait_in_query_cache_insert';
+SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3;
+=================================== Connection default
+** Assert that the SELECT-stmt thread reaches the sync point.
+SET DEBUG_SYNC="now WAIT_FOR parked2";
+**
+**
=================================== Connection thd3
** On THD3: Insert another result into the cache and block on the same
** debug hook.
-SET SESSION debug='+d,foobar,wait_in_query_cache_insert';
-SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;;
+SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
+SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5;
=================================== Connection default
-** Assert that the two SELECT-stmt threads to reach the hook.
+** Assert that the SELECT-stmt thread reaches the sync point.
+SET DEBUG_SYNC="now WAIT_FOR parked3";
**
**
** Signal the DELETE thread, THD1, to continue. It will enter the mutex
** lock and set query cache status to TABLE_FLUSH_IN_PROGRESS and then
** unlock the mutex before stopping on the next debug hook.
-SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_invalidate1' LIMIT 1 INTO @flush_thread_id;
-KILL QUERY @flush_thread_id;
+SET DEBUG_SYNC="now SIGNAL go1_1";
** Assert that we reach the next debug hook.
+SET DEBUG_SYNC="now WAIT_FOR parked1_2";
**
** Signal the remaining debug hooks blocking THD2 and THD3.
** The threads will grab the guard mutex enter the wait condition and
** and finally release the mutex. The threads will continue to wait
** until a broadcast signal reaches them causing both threads to
** come alive and check the condition.
-SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_insert' ORDER BY id ASC LIMIT 1 INTO @thread_id;
-KILL QUERY @thread_id;
-SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_insert' ORDER BY id DESC LIMIT 1 INTO @thread_id;
-KILL QUERY @thread_id;
+SET DEBUG_SYNC="now SIGNAL go2";
+** Wait for thd2 to receive the signal
+SET DEBUG_SYNC="now SIGNAL go3";
+** Wait for thd3 to receive the signal
**
** Finally signal the DELETE statement on THD1 one last time.
** The stmt will complete the query cache invalidation and return
@@ -152,8 +163,7 @@ KILL QUERY @thread_id;
** One signal will be sent to the thread group waiting for executing
** invalidations and a broadcast signal will be sent to the thread
** group holding result set writers.
-SELECT SQL_NO_CACHE id FROM information_schema.processlist WHERE state='wait_in_query_cache_invalidate2' LIMIT 1 INTO @flush_thread_id;
-KILL QUERY @flush_thread_id;
+SET DEBUG_SYNC="now SIGNAL go1_2";
**
*************************************************************************
** No tables should be locked
@@ -172,6 +182,7 @@ DELETE FROM t4;
DELETE FROM t5;
=================================== Connection thd1
** Done.
+SET DEBUG_SYNC= 'RESET';
SET GLOBAL query_cache_size= 0;
# Restore defaults
RESET QUERY CACHE;
@@ -179,3 +190,35 @@ FLUSH STATUS;
DROP TABLE t1,t2,t3,t4,t5;
SET GLOBAL query_cache_size= DEFAULT;
SET GLOBAL query_cache_type= DEFAULT;
+#
+# Bug#56822: Add a thread state for sessions waiting on the query cache lock
+#
+SET @old_query_cache_size= @@GLOBAL.query_cache_size;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SET GLOBAL concurrent_insert= 1;
+SET GLOBAL query_cache_size= 1024*512;
+SET GLOBAL query_cache_type= ON;
+# Switch to connection con1
+SET DEBUG_SYNC = "wait_in_query_cache_invalidate2 SIGNAL parked WAIT_FOR go";
+# Send INSERT, will wait in the query cache table invalidation
+INSERT INTO t1 VALUES (4);;
+# Switch to connection default
+# Wait for insert to reach the debug point
+SET DEBUG_SYNC = "now WAIT_FOR parked";
+# Switch to connection con2
+# Send a query that should wait on the query cache lock
+RESET QUERY CACHE;
+# Switch to connection default
+# Wait for the state to be reflected in the processlist
+# Signal that the query cache can be unlocked
+SET DEBUG_SYNC="now SIGNAL go";
+# Reap con1 and disconnect
+# Reap con2 and disconnect
+# Restore defaults
+SET DEBUG_SYNC= 'RESET';
+RESET QUERY CACHE;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= DEFAULT;
+SET GLOBAL query_cache_type= DEFAULT;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 1b1ac169869..eff45844064 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1666,4 +1666,105 @@ c_key c_notkey
1 1
3 3
DROP TABLE t1;
+#
+# Bug #57030: 'BETWEEN' evaluation is incorrect
+#
+CREATE TABLE t1(pk INT PRIMARY KEY, i4 INT);
+CREATE UNIQUE INDEX i4_uq ON t1(i4);
+INSERT INTO t1 VALUES (1,10), (2,20), (3,30);
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const i4_uq i4_uq 5 const 1
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
+pk i4
+1 10
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const i4_uq i4_uq 5 const 1
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
+pk i4
+1 10
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range i4_uq i4_uq 5 NULL 3 Using where
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
+pk i4
+1 10
+2 20
+3 30
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using where
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
+pk i4
+1 10
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
+pk i4
+1 10
+2 20
+3 30
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
+pk i4
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
+pk i4
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
+pk i4
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using where
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
+pk i4
+1 10
+2 20
+3 30
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
+pk i4
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using where
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
+pk i4
+1 10
+2 20
+EXPLAIN
+SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL i4_uq NULL NULL NULL 3
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using where
+SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
+pk i4 pk i4
+EXPLAIN
+SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL i4_uq NULL NULL NULL 3
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using where
+SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
+pk i4 pk i4
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/rpl_mysqldump_slave.result b/mysql-test/r/rpl_mysqldump_slave.result
index 2229725a61d..76caab5fcfa 100644
--- a/mysql-test/r/rpl_mysqldump_slave.result
+++ b/mysql-test/r/rpl_mysqldump_slave.result
@@ -1,9 +1,5 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
#
# New --dump-slave, --apply-slave-statements functionality
#
@@ -15,3 +11,4 @@ START SLAVE;
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT='MASTER_MYPORT', MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START;
START SLAVE;
+include/rpl_end.inc
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index b5716264f56..49fea815b62 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4866,6 +4866,70 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
1
1
DROP TABLE t1;
+#
+# Bug #58422: Incorrect result when OUTER JOIN'ing
+# with an empty table
+#
+CREATE TABLE t_empty(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+CREATE TABLE t1(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+CREATE TABLE t2(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
+INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
+EXPLAIN
+SELECT *
+FROM
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON TRUE)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT *
+FROM
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON TRUE)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+pk i pk i pk i
+EXPLAIN
+SELECT *
+FROM
+t1
+LEFT OUTER JOIN
+(t2 CROSS JOIN t_empty)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT *
+FROM
+t1
+LEFT OUTER JOIN
+(t2 CROSS JOIN t_empty)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+pk i pk i pk i
+EXPLAIN
+SELECT *
+FROM
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON t_empty.i=t2.i)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT *
+FROM
+t1
+LEFT OUTER JOIN
+(t2 INNER JOIN t_empty ON t_empty.i=t2.i)
+ON t1.pk=t2.pk
+WHERE t2.pk <> 2;
+pk i pk i pk i
+DROP TABLE t1,t2,t_empty;
End of 5.1 tests
#
# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
@@ -4886,3 +4950,22 @@ col_int_key
DROP VIEW view_t1;
DROP TABLE t1;
# End of test BUG#54515
+#
+# Bug #57203 Assertion `field_length <= 255' failed.
+#
+SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+UNION ALL
+SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+AS foo
+;
+coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
+0.0000
+0.0000
+CREATE table t1(a text);
+INSERT INTO t1 VALUES (''), ('');
+SELECT avg(distinct(t1.a)) FROM t1, t1 t2
+GROUP BY t2.a ORDER BY t1.a;
+avg(distinct(t1.a))
+0
+DROP TABLE t1;
+# End of test BUG#57203
diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result
index 4f57049406d..53b2483d97e 100644
--- a/mysql-test/r/shm.result
+++ b/mysql-test/r/shm.result
@@ -2155,6 +2155,8 @@ mysqld is alive
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
+Warnings:
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET GLOBAL net_buffer_length= 1024;
ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes
SET GLOBAL max_allowed_packet= @max_allowed_packet;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 073b0b331f0..351bfaf9d96 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -663,6 +663,8 @@ flush tables;
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
t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
+Warnings:
+Warning 1033 Incorrect information in file: './test/t1.frm'
show create table t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
drop table if exists t1;
@@ -1323,8 +1325,20 @@ Tables_in_test Table_type
été BASE TABLE
drop table `été`;
set names latin1;
+#
+# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
+# Character set: Latin-1 (ISO-8859-1)
+#
+SET NAMES latin1;
+CREATE DATABASE `ä`;
+CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory;
+SHOW TABLE STATUS FROM `ä` LIKE 'ä';
+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
+ä MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+DROP DATABASE `ä`;
show columns from `#mysql50#????????`;
Got one of the listed errors
+call mtr.add_suppression("Can.t find file: '.\\\\test\\\\\\?{8}.frm'");
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1(c1 INT);
@@ -1514,3 +1528,27 @@ ALTER TABLE t1 CHARACTER SET = utf8;
COMMIT;
DROP TRIGGER t1_bi;
DROP TABLE t1;
+#
+# Bug#57306 SHOW PROCESSLIST does not display string literals well.
+#
+SET NAMES latin1;
+SELECT GET_LOCK('t', 1000);
+GET_LOCK('t', 1000)
+1
+SET NAMES latin1;
+SELECT GET_LOCK('t',1000) AS 'óóóó';;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+### root ### test Query ### ### SHOW PROCESSLIST
+### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
+SET NAMES utf8;
+SHOW PROCESSLIST;
+Id User Host db Command Time State Info
+### root ### test Query ### ### SHOW PROCESSLIST
+### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó'
+SELECT RELEASE_LOCK('t');
+RELEASE_LOCK('t')
+1
+óóóó
+1
+SET NAMES latin1;
diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result
index 67bf9330451..cfa056d5d13 100644
--- a/mysql-test/r/signal.result
+++ b/mysql-test/r/signal.result
@@ -1379,9 +1379,6 @@ MESSAGE_TEXT = msg,
MYSQL_ERRNO = 1012;
end $$
insert into t1 values (1), (2) $$
-Warnings:
-Warning 1012 This trigger SIGNAL a warning, a=1
-Warning 1012 This trigger SIGNAL a warning, a=2
drop trigger t1_ai $$
create trigger t1_ai after insert on t1 for each row
begin
@@ -1416,11 +1413,7 @@ MESSAGE_TEXT = NEW.msg,
MYSQL_ERRNO = NEW.errno;
end $$
insert into t1 set errno=1012, msg='Warning message 1 in trigger' $$
-Warnings:
-Warning 1012 Warning message 1 in trigger
insert into t1 set errno=1013, msg='Warning message 2 in trigger' $$
-Warnings:
-Warning 1013 Warning message 2 in trigger
drop table t1 $$
drop table if exists t1 $$
drop procedure if exists p1 $$
diff --git a/mysql-test/r/signal_code.result b/mysql-test/r/signal_code.result
index 2ecba4701fa..ca46f1d2079 100644
--- a/mysql-test/r/signal_code.result
+++ b/mysql-test/r/signal_code.result
@@ -20,16 +20,16 @@ return 0;
end $$
show procedure code signal_proc;
Pos Instruction
-0 stmt 131 "SIGNAL foo"
-1 stmt 131 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
-2 stmt 132 "RESIGNAL foo"
-3 stmt 132 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
+0 stmt 130 "SIGNAL foo"
+1 stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
+2 stmt 131 "RESIGNAL foo"
+3 stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
drop procedure signal_proc;
show function code signal_func;
Pos Instruction
-0 stmt 131 "SIGNAL foo"
-1 stmt 131 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
-2 stmt 132 "RESIGNAL foo"
-3 stmt 132 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
+0 stmt 130 "SIGNAL foo"
+1 stmt 130 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
+2 stmt 131 "RESIGNAL foo"
+3 stmt 131 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
4 freturn 3 0
drop function signal_func;
diff --git a/mysql-test/r/sp-bugs.result b/mysql-test/r/sp-bugs.result
index a88c89537e2..2425f40d9c2 100644
--- a/mysql-test/r/sp-bugs.result
+++ b/mysql-test/r/sp-bugs.result
@@ -75,4 +75,40 @@ CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
+#
+# Bug#54375: Error in stored procedure leaves connection
+# in different default schema
+#
+SET @@SQL_MODE = 'STRICT_ALL_TABLES';
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+USE db1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+CREATE FUNCTION f1 (
+some_value int
+)
+RETURNS smallint
+DETERMINISTIC
+BEGIN
+INSERT INTO t1 SET c1 = some_value;
+RETURN(LAST_INSERT_ID());
+END$$
+DROP DATABASE IF EXISTS db2;
+CREATE DATABASE db2;
+USE db2;
+SELECT DATABASE();
+DATABASE()
+db2
+SELECT db1.f1(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT DATABASE();
+DATABASE()
+db2
+USE test;
+DROP FUNCTION db1.f1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
+DROP DATABASE db2;
End of 5.1 tests
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index c7ea4cbb311..16a43a00f04 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -155,11 +155,11 @@ Pos Instruction
0 stmt 9 "drop temporary table if exists sudoku..."
1 stmt 1 "create temporary table sudoku_work ( ..."
2 stmt 1 "create temporary table sudoku_schedul..."
-3 stmt 89 "call sudoku_init()"
+3 stmt 88 "call sudoku_init()"
4 jump_if_not 7(8) p_naive@0
5 stmt 4 "update sudoku_work set cnt = 0 where ..."
6 jump 8
-7 stmt 89 "call sudoku_count()"
+7 stmt 88 "call sudoku_count()"
8 stmt 6 "insert into sudoku_schedule (row,col)..."
9 set v_scounter@2 0
10 set v_i@3 1
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index fbe982b86bc..a529a62680b 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -1,4 +1,5 @@
call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
+call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc");
flush table mysql.proc;
use test;
drop procedure if exists bug14233;
@@ -151,3 +152,21 @@ Warnings:
Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
# Restore mysql.proc.
drop table mysql.proc;
+#
+# Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8
+#
+DROP TABLE IF EXISTS proc_backup;
+DROP DATABASE IF EXISTS db1;
+# Backup the proc table
+RENAME TABLE mysql.proc TO proc_backup;
+CREATE TABLE mysql.proc LIKE proc_backup;
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() SET @foo = 10;
+# Modify a field of the table.
+ALTER TABLE mysql.proc MODIFY comment CHAR (32);
+DROP DATABASE db1;
+Warnings:
+Error 1548 Cannot load from mysql.proc. The table is probably corrupted
+# Restore mysql.proc
+DROP TABLE mysql.proc;
+RENAME TABLE proc_backup TO mysql.proc;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 7b8364379df..4e97429c48f 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1877,9 +1877,6 @@ DROP PROCEDURE p1;
#
# Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
#
-
-# - Case 1
-
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1, 2);
CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
@@ -1889,40 +1886,13 @@ SET NEW.a = 10;
SET NEW.a = 99999999999;
END|
UPDATE t1 SET b = 20;
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
SHOW WARNINGS;
Level Code Message
-Warning 1264 Out of range value for column 'a' at row 1
SELECT * FROM t1;
a b
10 20
DROP TRIGGER t1_bu;
DROP TABLE t1;
-
-# - Case 2
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(b CHAR(1));
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
-INSERT INTO t2 VALUES('ab'); # Produces a warning.
-INSERT INTO t2 VALUES('b'); # Does not produce a warning,
-# previous warning should be cleared.
-END|
-INSERT INTO t1 VALUES(0);
-SHOW WARNINGS;
-Level Code Message
-SELECT * FROM t1;
-a
-0
-SELECT * FROM t2;
-b
-a
-b
-DROP TRIGGER t1_bi;
-DROP TABLE t1;
-DROP TABLE t2;
#
# Bug#9857: Stored procedures: handler for sqlwarning ignored
#
@@ -1961,3 +1931,64 @@ Warning 1365 Division by 0
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET sql_mode = @sql_mode_saved;
+#
+# Bug#55850: Trigger warnings not cleared.
+#
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
+CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT,
+d SMALLINT, e SMALLINT, f SMALLINT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+INSERT INTO t2(a, b, c) VALUES(99999, 99999, 99999);
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+INSERT INTO t2(d, e, f) VALUES(99999, 99999, 99999);
+CREATE PROCEDURE p1()
+INSERT INTO t1 VALUES(99999, 99999, 99999);
+
+CALL p1();
+Warnings:
+Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'z' at row 1
+
+SHOW WARNINGS;
+Level Code Message
+Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'z' at row 1
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+# ----------------------------------------------------------------------
+CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
+CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT NOT NULL);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+INSERT INTO t2 VALUES(
+CAST('111111 ' AS SIGNED),
+CAST('222222 ' AS SIGNED),
+NULL);
+END|
+CREATE PROCEDURE p1()
+INSERT INTO t1 VALUES(99999, 99999, 99999);
+
+CALL p1();
+ERROR 23000: Column 'c' cannot be null
+
+SHOW WARNINGS;
+Level Code Message
+Warning 1264 Out of range value for column 'x' at row 1
+Warning 1264 Out of range value for column 'y' at row 1
+Warning 1264 Out of range value for column 'z' at row 1
+Warning 1292 Truncated incorrect INTEGER value: '111111 '
+Warning 1264 Out of range value for column 'a' at row 1
+Warning 1292 Truncated incorrect INTEGER value: '222222 '
+Warning 1264 Out of range value for column 'b' at row 1
+Error 1048 Column 'c' cannot be null
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result
index 0d3e87f17e2..860312dca3e 100644
--- a/mysql-test/r/sp-lock.result
+++ b/mysql-test/r/sp-lock.result
@@ -735,5 +735,96 @@ END latin1 latin1_swedish_ci latin1_swedish_ci
# Connection default;
DROP PROCEDURE p1;
#
+# Bug#57663 Concurrent statement using stored function and DROP DATABASE
+# breaks SBR
+#
+DROP DATABASE IF EXISTS db1;
+DROP FUNCTION IF EXISTS f1;
+# Test 1: Check that DROP DATABASE block if a function is used
+# by an active transaction.
+# Connection default
+CREATE DATABASE db1;
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+START TRANSACTION;
+SELECT db1.f1();
+db1.f1()
+1
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Waiting for DROP DATABASE to be blocked by the lock on f1()
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Test 2: Check that DROP DATABASE blocks if a procedure is
+# used by an active transaction.
+# Connection default
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() BEGIN END;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+CALL db1.p1();
+RETURN 1;
+END|
+START TRANSACTION;
+SELECT f1();
+f1()
+1
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Waiting for DROP DATABASE to be blocked by the lock on p1()
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Test 3: Check that DROP DATABASE is not selected as a victim if a
+# deadlock is discovered with DML statements.
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1 (a INT);
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+START TRANSACTION;
+SELECT db1.f1();
+db1.f1()
+1
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection default
+# Waiting for DROP DATABASE to be blocked by the lock on f1()
+SELECT * FROM db1.t1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Test 4: Check that active DROP DATABASE blocks stored routine DDL.
+# Connection default
+CREATE DATABASE db1;
+CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
+CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2;
+START TRANSACTION;
+SELECT db1.f2();
+db1.f2()
+2
+# Connection con1
+# Sending:
+DROP DATABASE db1;
+# Connection con2
+# Waiting for DROP DATABASE to be blocked by the lock on f2()
+# Sending:
+ALTER FUNCTION db1.f1 COMMENT "test";
+# Connection default
+# Waiting for ALTER FUNCTION to be blocked by the schema lock on db1
+COMMIT;
+# Connection con1
+# Reaping: DROP DATABASE db1
+# Connection con2
+# Reaping: ALTER FUNCTION f1 COMMENT 'test'
+ERROR 42000: FUNCTION db1.f1 does not exist
+# Connection default
+DROP FUNCTION f1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 4ea26d1021a..c09579b13eb 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -44,7 +44,7 @@ ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy;
-ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.dummy'
drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
drop function db1_secret.db;
@@ -58,7 +58,7 @@ ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
drop procedure db1_secret.dummy;
-ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.dummy'
drop procedure db1_secret.stamp;
ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
drop function db1_secret.db;
@@ -567,3 +567,28 @@ DROP USER 'tester';
DROP USER 'Tester';
DROP DATABASE B48872;
End of 5.0 tests.
+#
+# Test for bug#57061 "User without privilege on routine can discover
+# its existence."
+#
+drop database if exists mysqltest_db;
+create database mysqltest_db;
+# Create user with no privileges on mysqltest_db database.
+create user bug57061_user@localhost;
+create function mysqltest_db.f1() returns int return 0;
+create procedure mysqltest_db.p1() begin end;
+# Connect as user 'bug57061_user@localhost'
+# Attempt to drop routine on which user doesn't have privileges
+# should result in the same 'access denied' type of error whether
+# routine exists or not.
+drop function if exists mysqltest_db.f_does_not_exist;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f_does_not_exist'
+drop procedure if exists mysqltest_db.p_does_not_exist;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p_does_not_exist'
+drop function if exists mysqltest_db.f1;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.f1'
+drop procedure if exists mysqltest_db.p1;
+ERROR 42000: alter routine command denied to user 'bug57061_user'@'localhost' for routine 'mysqltest_db.p1'
+# Connection 'default'.
+drop user bug57061_user@localhost;
+drop database mysqltest_db;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 0f18e0e5d6f..0c9b5e30c04 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7451,4 +7451,52 @@ c1
# Cleanup
drop table t1;
drop procedure p1;
+#
+# BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW)
+# FAILS IN SET_FIELD_ITERATOR
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE VIEW v1 AS SELECT a FROM t2;
+CREATE PROCEDURE proc() SELECT * FROM t1 NATURAL JOIN v1;
+ALTER TABLE t2 CHANGE COLUMN a b CHAR;
+
+CALL proc();
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+CALL proc();
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+
+DROP TABLE t1,t2;
+DROP VIEW v1;
+DROP PROCEDURE proc;
+
+# --
+# -- Bug 11765684 - 58674: SP-cache does not detect changes in
+# -- pre-locking list caused by triggers
+# ---
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+DROP PROCEDURE IF EXISTS p1;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+CREATE TABLE t3(a INT);
+CREATE PROCEDURE p1()
+INSERT INTO t1(a) VALUES (1);
+
+CREATE TRIGGER t1_ai AFTER INSERT ON t1
+FOR EACH ROW
+INSERT INTO t2(a) VALUES (new.a);
+
+CALL p1();
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1
+FOR EACH ROW
+INSERT INTO t3(a) VALUES (new.a);
+
+CALL p1();
+
+DROP TABLE t1, t2, t3;
+DROP PROCEDURE p1;
+
# End of 5.5 test
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 44d62f17f95..58744a3be2d 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -9,9 +9,11 @@ end|
call bug4902()|
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
call bug4902()|
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
drop procedure bug4902|
drop procedure if exists bug4902_2|
create procedure bug4902_2()
@@ -154,9 +156,11 @@ create procedure 15298_2 () sql security definer show grants;
call 15298_1();
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
call 15298_2();
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
@@ -200,7 +204,6 @@ CREATE PROCEDURE p1(i INT) BEGIN END;
DROP PROCEDURE p1;
DELETE FROM mysql.user WHERE User='mysqltest_1';
FLUSH PRIVILEGES;
-set @@global.concurrent_insert= @old_concurrent_insert;
#
# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
#
@@ -234,3 +237,25 @@ DROP FUNCTION f1;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
+#
+# Test for bug#11763757 "56510: ERROR 42000: FUNCTION DOES NOT EXIST
+# IF NOT-PRIV USER RECONNECTS ".
+#
+# The real problem was that server was unable handle properly stored
+# functions in databases which names contained dot.
+#
+DROP DATABASE IF EXISTS `my.db`;
+create database `my.db`;
+use `my.db`;
+CREATE FUNCTION f1(a int) RETURNS INT RETURN a;
+# Create new connection.
+USE `my.db`;
+SELECT f1(1);
+f1(1)
+1
+SELECT `my.db`.f1(2);
+`my.db`.f1(2)
+2
+# Switching to default connection.
+DROP DATABASE `my.db`;
+set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result
index 4fa91121f50..4163725a196 100644
--- a/mysql-test/r/sp_trans.result
+++ b/mysql-test/r/sp_trans.result
@@ -585,3 +585,20 @@ UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
ERROR 23000: Column 'f2' cannot be null
DROP TABLE t1_aux, t1_not_null|
DROP FUNCTION f1_two_inserts|
+#
+# Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c
+#
+DROP PROCEDURE IF EXISTS p1|
+DROP TABLE IF EXISTS t1|
+CREATE TABLE t1 (a INT) ENGINE=INNODB|
+CREATE PROCEDURE p1()
+BEGIN
+TRUNCATE TABLE t1;
+END|
+LOCK TABLES t1 WRITE|
+CALL p1()|
+FLUSH TABLES;
+UNLOCK TABLES|
+CALL p1()|
+DROP PROCEDURE p1|
+DROP TABLE t1|
diff --git a/mysql-test/r/ssl_and_innodb.result b/mysql-test/r/ssl_and_innodb.result
new file mode 100644
index 00000000000..71373fc4033
--- /dev/null
+++ b/mysql-test/r/ssl_and_innodb.result
@@ -0,0 +1,8 @@
+CREATE TABLE t1(a int) engine=innodb;
+INSERT INTO t1 VALUES (1);
+SELECT DISTINCT
+convert((SELECT des_decrypt(2,1) AS a FROM t1 WHERE @a:=1), signed) as d
+FROM t1 ;
+d
+2
+DROP TABLE t1;
diff --git a/mysql-test/r/ssl_cipher.result b/mysql-test/r/ssl_cipher.result
new file mode 100644
index 00000000000..78081300b5b
--- /dev/null
+++ b/mysql-test/r/ssl_cipher.result
@@ -0,0 +1,9 @@
+#
+# BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
+#
+SHOW STATUS LIKE 'Ssl_cipher';
+Variable_name Value
+Ssl_cipher AES128-SHA
+SHOW STATUS LIKE 'Ssl_cipher_list';
+Variable_name Value
+Ssl_cipher_list AES128-SHA
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index c0cd0f7bc1a..ce3acba9b8a 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -238,11 +238,5 @@ SELECT 9;
9
DROP PROCEDURE p1;
DROP FUNCTION f1;
-DROP VIEW IF EXISTS v1;
-CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
-SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
-SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
-NAME
-DROP VIEW v1;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
diff --git a/mysql-test/r/status_bug17954.result b/mysql-test/r/status_bug17954.result
new file mode 100644
index 00000000000..5c244cd8aca
--- /dev/null
+++ b/mysql-test/r/status_bug17954.result
@@ -0,0 +1,13 @@
+set @old_concurrent_insert= @@global.concurrent_insert;
+set @@global.concurrent_insert= 0;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL LOG_OUTPUT = 'FILE';
+flush status;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+NAME
+DROP VIEW v1;
+set @@global.concurrent_insert= @old_concurrent_insert;
+SET GLOBAL log_output = @old_log_output;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index f4e07636467..7531acda7a5 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -5252,8 +5252,90 @@ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
SELECT * FROM t2 UNION SELECT * FROM t2
ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
DROP TABLE t1,t2;
+#
+# Bug #58818: Incorrect result for IN/ANY subquery
+# with HAVING condition
+#
+CREATE TABLE t1(i INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE TABLE t1s(i INT);
+INSERT INTO t1s VALUES (10), (20), (30);
+CREATE TABLE t2s(i INT);
+INSERT INTO t2s VALUES (100), (200), (300);
+SELECT * FROM t1
+WHERE t1.i NOT IN
+(
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+);
+i
+1
+2
+3
+SELECT * FROM t1
+WHERE t1.I IN
+(
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+) IS UNKNOWN;
+i
+SELECT * FROM t1
+WHERE NOT t1.I = ANY
+(
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+);
+i
+1
+2
+3
+SELECT * FROM t1
+WHERE t1.i = ANY (
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+) IS UNKNOWN;
+i
+DROP TABLE t1,t1s,t2s;
End of 5.1 tests
#
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+#
+# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
+# Assertion `file' failed.
+#
+CREATE TABLE t1 (a INT);
+SELECT 1 FROM
+(SELECT ROW(
+(SELECT 1 FROM t1 RIGHT JOIN
+(SELECT 1 FROM t1, t1 t2) AS d ON 1),
+1) FROM t1) AS e;
+ERROR 21000: Operand should contain 1 column(s)
+DROP TABLE t1;
+#
# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
#
create table t1 (i int not null primary key);
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 72fa5f23ab1..63d051e03f2 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -186,6 +186,17 @@ a b
2 NULL
DROP TABLE t1, t2, t3, t4, t5;
#
+# Bug#58207: invalid memory reads when using default column value and
+# tmptable needed
+#
+CREATE TABLE t(a VARCHAR(245) DEFAULT
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
+INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),('');
+SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
+default(a)
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+DROP TABLE t;
+#
# End of 5.1 tests.
#
#
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 6c6d563e284..ab623ad6a28 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -245,3 +245,12 @@ x
NULL
drop procedure p1;
drop tables t1,t2,t3;
+#
+# Bug#60085 crash in Item::save_in_field() with time data type
+#
+CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
+INSERT INTO t1 VALUES ('2011-05-13', 0);
+SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a);
+a b
+2011-05-13 0
+DROP TABLE t1;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 4dac7443135..20736aec47f 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -22,7 +22,8 @@ insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;
-create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp" index directory="MYSQLTEST_VARDIR/run";
+create table t9 (a int not null auto_increment, b char(16) not null, primary key (a))
+engine=myisam data directory="MYSQLTEST_VARDIR/tmp" index directory="MYSQLTEST_VARDIR/run";
insert into t9 select * from t1;
check table t9;
Table Op Msg_type Msg_text
@@ -56,11 +57,17 @@ t9 CREATE TABLE `t9` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
create database mysqltest;
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
+create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
+engine=myisam index directory="/this-dir-does-not-exist";
Got one of the listed errors
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="MYSQLTEST_VARDIR/run";
+create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
+engine=myisam index directory="not-hard-path";
+ERROR 42000: Incorrect table name 'not-hard-path'
+create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
+engine=myisam index directory="MYSQLTEST_VARDIR/run";
Got one of the listed errors
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp";
+create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
+engine=myisam data directory="MYSQLTEST_VARDIR/tmp";
Got one of the listed errors
alter table t9 rename mysqltest.t9;
select count(*) from mysqltest.t9;
@@ -181,3 +188,28 @@ DROP TABLE user;
FLUSH TABLE mysql.user;
SELECT * FROM mysql.user;
End of 5.1 tests
+#
+# Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
+# STATEMENTS FAIL".
+#
+drop table if exists t1, t2;
+create table t1 (a int primary key) engine=myisam
+data directory="MYSQLTEST_VARDIR/tmp"
+ index directory="MYSQLTEST_VARDIR/run";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
+# CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
+# options should not fail. Per documentation newly created table
+# should not inherit value of these options from the original table.
+create table t2 like t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t1, t2;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index e963e1ebff7..10b14daf299 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -14,6 +14,7 @@ ndb_binlog_index
plugin
proc
procs_priv
+proxies_priv
servers
slow_log
tables_priv
@@ -119,8 +120,8 @@ user CREATE TABLE `user` (
`max_updates` int(11) unsigned NOT NULL DEFAULT '0',
`max_connections` int(11) unsigned NOT NULL DEFAULT '0',
`max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
- `plugin` char(60) CHARACTER SET latin1 NOT NULL DEFAULT '',
- `auth_string` text COLLATE utf8_bin NOT NULL,
+ `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
+ `authentication_string` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
show create table func;
diff --git a/mysql-test/r/tablespace.result b/mysql-test/r/tablespace.result
new file mode 100644
index 00000000000..38d450ae430
--- /dev/null
+++ b/mysql-test/r/tablespace.result
@@ -0,0 +1,112 @@
+CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN b int;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN b int;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+ALTER TABLE t1 TABLESPACE ts;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 TABLESPACE ts2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts2 */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+ALTER TABLE t1 STORAGE MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 STORAGE DISK;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(a int) ENGINE=MyISAM;
+ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts STORAGE MEMORY */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 STORAGE DISK TABLESPACE ts2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) /*!50100 TABLESPACE ts2 STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ `d` int(11) NOT NULL,
+ `e` int(11) DEFAULT NULL,
+ `f` int(11) DEFAULT NULL,
+ `g` int(11) DEFAULT NULL,
+ `h` int(11) NOT NULL,
+ `i` int(11) DEFAULT NULL,
+ `j` int(11) DEFAULT NULL,
+ `k` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) /*!50100 TABLESPACE the_tablespacename STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
index d1f1ec87efd..284731d8dfc 100644
--- a/mysql-test/r/trigger-compat.result
+++ b/mysql-test/r/trigger-compat.result
@@ -41,3 +41,98 @@ DROP TABLE t2;
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
+USE test;
+#
+# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
+#
+DROP TABLE IF EXISTS t1, t2, t3;
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+CREATE TABLE t3 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1), (2), (3);
+INSERT INTO t3 VALUES (1), (2), (3);
+# We simulate importing a trigger from 5.0 by writing a .TRN file for
+# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
+# with syntax allowed in 5.0 only.
+#
+# Note that in 5.0 the following lines are missing from t1.TRG:
+#
+# client_cs_names='latin1'
+# connection_cl_names='latin1_swedish_ci'
+# db_cl_names='latin1_swedish_ci'
+FLUSH TABLE t1;
+FLUSH TABLE t2;
+# We will get parse errors for most DDL and DML statements when the table
+# has broken triggers. The parse error refers to the first broken
+# trigger.
+CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
+ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+INSERT INTO t1 VALUES (1);
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+INSERT INTO t2 VALUES (1);
+ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
+DELETE FROM t1;
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+UPDATE t1 SET a = 1 WHERE a = 1;
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+SELECT * FROM t1;
+a
+1
+2
+3
+RENAME TABLE t1 TO t1_2;
+ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+DROP TRIGGER tr11;
+Warnings:
+Warning 1603 Triggers for table `test`.`t1` have no creation context
+DROP TRIGGER tr12;
+DROP TRIGGER tr13;
+DROP TRIGGER tr14;
+DROP TRIGGER tr15;
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+# Make sure there is no trigger file left.
+# We write the same trigger files one more time to test DROP TABLE.
+FLUSH TABLE t1;
+FLUSH TABLE t2;
+DROP TABLE t1;
+Warnings:
+Warning 1603 Triggers for table `test`.`t1` have no creation context
+DROP TABLE t2;
+Warnings:
+Warning 1603 Triggers for table `test`.`t2` have no creation context
+DROP TABLE t3;
+# Make sure there is no trigger file left.
+CREATE TABLE t1 ( a INT );
+CREATE TABLE t2 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (1), (2), (3);
+# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
+# and last trigger is broken.
+# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
+FLUSH TABLE t1;
+SHOW CREATE TRIGGER tr12;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci
+Warnings:
+Warning 1603 Triggers for table `test`.`t1` have no creation context
+SHOW CREATE TRIGGER tr11;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
+tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci
+DROP TRIGGER tr12;
+DROP TRIGGER tr11;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result
index 2c4e355af9d..722ac79854d 100644
--- a/mysql-test/r/trigger-trans.result
+++ b/mysql-test/r/trigger-trans.result
@@ -151,9 +151,14 @@ CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1;
SET @a = 0;
SET @b = 0;
TRUNCATE t1;
+ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `test`.`t1` (`a`))
SELECT @a, @b;
@a @b
0 0
+DELETE FROM t1;
+SELECT @a, @b;
+@a @b
+1 1
INSERT INTO t1 VALUES (1);
DELETE FROM t1;
SELECT @a, @b;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index a1c21e18f83..faea2e791d5 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -821,7 +821,6 @@ drop trigger t1_bi;
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
execute stmt1;
call p1();
-ERROR 42S02: Table 'test.t3' doesn't exist
deallocate prepare stmt1;
drop procedure p1;
drop table t1, t2, t3;
@@ -1072,8 +1071,6 @@ SELECT @x;
NULL
SET @x=2;
UPDATE t1 SET i1 = @x;
-Warnings:
-Warning 1365 Division by 0
SELECT @x;
@x
NULL
@@ -1085,9 +1082,6 @@ SELECT @x;
NULL
SET @x=4;
UPDATE t1 SET i1 = @x;
-Warnings:
-Warning 1365 Division by 0
-Warning 1365 Division by 0
SELECT @x;
@x
NULL
@@ -1198,8 +1192,6 @@ Warnings:
Warning 1365 Division by 0
create trigger t1_bi before insert on t1 for each row set @a:=1/0|
insert into t1 values(20, 20)|
-Warnings:
-Warning 1365 Division by 0
drop trigger t1_bi|
create trigger t1_bi before insert on t1 for each row
begin
@@ -1218,8 +1210,6 @@ set @a:=1/0;
end|
set @check=0, @t4_bi_called=0, @t4_bu_called=0|
insert into t1 values(30, 30)|
-Warnings:
-Warning 1365 Division by 0
select @check, @t4_bi_called, @t4_bu_called|
@check @t4_bi_called @t4_bu_called
2 1 1
@@ -2063,12 +2053,8 @@ SELECT 1 FROM t1 c WHERE
END//
SET @bug51650 = 1;
INSERT IGNORE INTO t2 VALUES();
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
INSERT IGNORE INTO t1 SET b = '777';
INSERT IGNORE INTO t2 SET a = '111';
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
SET @bug51650 = 1;
INSERT IGNORE INTO t2 SET a = '777';
DROP TRIGGER trg1;
@@ -2105,7 +2091,7 @@ CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1
SHOW TRIGGERS IN db1;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
INSERT INTO t2 VALUES (1);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1)' at line 1
+ERROR 42000: Trigger 'trg1' has an error in its body: '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 'VALUES (1)' at line 1'
SELECT * FROM t1;
b
# Work around Bug#45235
@@ -2150,8 +2136,6 @@ SELECT 'ab' INTO a;
SELECT 'a' INTO a;
END|
INSERT INTO t1 VALUES (1);
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TRIGGER IF EXISTS trg1;
@@ -2169,20 +2153,12 @@ DECLARE trg2 CHAR;
SELECT 'ab' INTO trg2;
END|
INSERT INTO t1 VALUES (0);
-Warnings:
-Warning 1265 Data truncated for column 'trg1' at row 1
-Warning 1265 Data truncated for column 'trg2' at row 1
SELECT * FROM t1;
a
0
SHOW WARNINGS;
Level Code Message
INSERT INTO t1 VALUES (1),(2);
-Warnings:
-Warning 1265 Data truncated for column 'trg1' at row 1
-Warning 1265 Data truncated for column 'trg2' at row 1
-Warning 1265 Data truncated for column 'trg1' at row 1
-Warning 1265 Data truncated for column 'trg2' at row 1
DROP TRIGGER trg1;
DROP TRIGGER trg2;
DROP TABLE t1;
@@ -2205,4 +2181,22 @@ trigger_name
# Clean-up.
drop temporary table t1;
drop table t1;
-End of 6.0 tests.
+
+#
+# Bug #12362125: SP INOUT HANDLING IS BROKEN FOR TEXT TYPE.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(c TEXT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+DECLARE v TEXT;
+SET v = 'aaa';
+SET NEW.c = v;
+END|
+INSERT INTO t1 VALUES('qazwsxedc');
+SELECT c FROM t1;
+c
+aaa
+DROP TABLE t1;
+
+End of 5.5 tests.
diff --git a/mysql-test/r/truncate_coverage.result b/mysql-test/r/truncate_coverage.result
index a7a4b9c70f4..728702f7ab5 100644
--- a/mysql-test/r/truncate_coverage.result
+++ b/mysql-test/r/truncate_coverage.result
@@ -78,3 +78,30 @@ COMMIT;
UNLOCK TABLES;
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
+#
+# Bug#57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE
+#
+# Note that this test case only reproduces the problem
+# when it is run with valgrind.
+DROP TABLE IF EXISTS t1, m1;
+CREATE TABLE t1(a INT) engine=memory;
+CREATE TABLE m1(a INT) engine=merge UNION(t1);
+# Connection con1
+SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped';
+# Sending:
+TRUNCATE TABLE m1;
+# Connection con2
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+# Sending:
+FLUSH TABLES;
+# Connection default
+# Waiting for FLUSH TABLES to be blocked.
+SET DEBUG_SYNC= 'now SIGNAL dropped';
+# Connection con1
+# Reaping: TRUNCATE TABLE m1
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+# Connection con2
+# Reaping: FLUSH TABLES
+# Connection default
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE m1, t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 78f31286ea7..e3363fcabf9 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2;
LENGTH(c)
65535
DROP TABLE t1, t2;
+# Bug #52160: crash and inconsistent results when grouping
+# by a function and column
+CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
+CREATE TABLE t1(a CHAR(1));
+INSERT INTO t1 VALUES ('0'), ('0');
+SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
+COUNT(*)
+2
+DROP FUNCTION f1;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 80aa63467a9..4f679e4f28d 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -300,6 +300,18 @@ the_date the_time the_date the_time
2010-01-01 01:01:01 2010-01-01 01:01:01
DROP TABLE t1;
DROP VIEW v1;
+#
+# Bug#59685 crash in String::length with date types
+#
+CREATE TABLE t1(a DATE, b YEAR, KEY(a));
+INSERT INTO t1 VALUES ('2011-01-01',2011);
+SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1;
+b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a)
+1
+SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1;
+b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE)
+1
+DROP TABLE t1;
End of 5.1 tests
#
# Bug #33629: last_day function can return null, but has 'not null'
@@ -322,4 +334,12 @@ f1 date YES NULL
f2 date YES NULL
DROP TABLE t1;
#
+#
+# Bug#57278: Crash on min/max + with date out of range.
+#
+set @a=(select min(makedate('111','1'))) ;
+select @a;
+@a
+0111-01-01
+#
End of 6.0 tests
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index a37d3945ca1..a1e461f3f88 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -635,6 +635,17 @@ CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7))
20080729104251.1234560
Warnings:
Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567'
+#
+# Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
+# Day is ZERO
+#
+CREATE TABLE t1 (dt1 DATETIME);
+INSERT INTO t1 (dt1) VALUES ('0000-00-01 00:00:01');
+DELETE FROM t1 WHERE dt1 = '0000-00-01 00:00:01';
+# Should be empty
+SELECT * FROM t1;
+dt1
+DROP TABLE t1;
End of 5.1 tests
#
# Start of 5.5 tests
@@ -678,5 +689,63 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 8 const 1 Using index
DROP TABLE t1,t2;
#
+# Bug#57095: Wrongly chosen expression cache type led to a wrong
+# result.
+#
+CREATE TABLE t1 (`b` datetime );
+INSERT INTO t1 VALUES ('2010-01-01 00:00:00'), ('2010-01-01 00:00:00');
+SELECT * FROM t1 WHERE b <= coalesce(NULL, now());
+b
+2010-01-01 00:00:00
+2010-01-01 00:00:00
+DROP TABLE t1;
+#
+#
+# BUG#12561818: RERUN OF STORED FUNCTION GIVES ERROR 1172:
+# RESULT CONSISTED OF MORE THAN ONE ROW
+#
+CREATE TABLE t1 (a DATE NOT NULL, b INT);
+INSERT INTO t1 VALUES ('0000-00-00',1), ('1999-05-10',2);
+CREATE TABLE t2 (a DATETIME NOT NULL, b INT);
+INSERT INTO t2 VALUES ('0000-00-00 00:00:00',1), ('1999-05-10 00:00:00',2);
+
+SELECT * FROM t1 WHERE a IS NULL;
+a b
+0000-00-00 1
+SELECT * FROM t2 WHERE a IS NULL;
+a b
+0000-00-00 00:00:00 1
+SELECT * FROM t1 LEFT JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+SELECT * FROM t2 LEFT JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+a b a b
+0000-00-00 00:00:00 1 0000-00-00 00:00:00 1
+1999-05-10 00:00:00 2 0000-00-00 00:00:00 1
+SELECT * FROM t1 JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+SELECT * FROM t2 JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+a b a b
+0000-00-00 00:00:00 1 0000-00-00 00:00:00 1
+1999-05-10 00:00:00 2 0000-00-00 00:00:00 1
+
+PREPARE stmt1 FROM
+'SELECT *
+ FROM t1 LEFT JOIN t1 AS t1_2 ON 1
+ WHERE t1_2.a IS NULL AND t1_2.b < 2';
+EXECUTE stmt1;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+EXECUTE stmt1;
+a b a b
+0000-00-00 1 0000-00-00 1
+1999-05-10 2 0000-00-00 1
+DEALLOCATE PREPARE stmt1;
+DROP TABLE t1,t2;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 819e41f41c5..c9db73c5f85 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1920,4 +1920,17 @@ SELECT SUM(DISTINCT a) FROM t1;
SUM(DISTINCT a)
0.0000
DROP TABLE t1;
+#
+# Bug#55436: buffer overflow in debug binary of dbug_buff in
+# Field_new_decimal::store_value
+#
+SET SQL_MODE='';
+CREATE TABLE t1(f1 DECIMAL(44,24)) ENGINE=MYISAM;
+INSERT INTO t1 SET f1 = -64878E-85;
+Warnings:
+Note 1265 Data truncated for column 'f1' at row 1
+SELECT f1 FROM t1;
+f1
+0.000000000000000000000000
+DROP TABLE IF EXISTS t1;
End of 5.1 tests
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index ac3d52b9ead..d99c2363d62 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -271,7 +271,7 @@ drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
-auto int(6) unsigned NULL NO PRI 0 #
+auto int(11) unsigned NULL NO PRI 0 #
t1 int(1) NULL NO 0 #
t2 varchar(1) latin1_swedish_ci NO #
t3 varchar(256) latin1_swedish_ci NO #
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 10a2b47ba02..55f8b0753a8 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -523,6 +523,69 @@ a
2000-01-01 00:00:01
2000-01-01 00:00:01
DROP TABLE t1;
+#
+# Bug#50774: failed to get the correct resultset when timestamp values
+# are appended with .0
+#
+CREATE TABLE t1 ( a TIMESTAMP, KEY ( a ) );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:01' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:02' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:03' );
+INSERT INTO t1 VALUES( '2010-02-01 09:31:04' );
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:02
+2010-02-01 09:31:03
+2010-02-01 09:31:04
+SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a;
+a
+2010-02-01 09:31:02
+2010-02-01 09:31:03
+2010-02-01 09:31:04
+SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:01
+2010-02-01 09:31:02
+SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a;
+a
+2010-02-01 09:31:01
+2010-02-01 09:31:02
+EXPLAIN
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+id select_type table type possible_keys key key_len ref rows Extra
+x x x range x x x x x x
+SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:02
+2010-02-01 09:31:03
+2010-02-01 09:31:04
+CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:01' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:02' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:03' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:04' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:05' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:06' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:07' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:08' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:09' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:10' );
+INSERT INTO t2 VALUES( '2010-02-01 09:31:11' );
+# The bug would cause the range optimizer's comparison to use an open
+# interval here. This reveals itself only in the number of reads
+# performed.
+FLUSH STATUS;
+EXPLAIN
+SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
+id select_type table type possible_keys key key_len ref rows Extra
+x x x range x x x x x x
+SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
+a
+2010-02-01 09:31:01
+SHOW STATUS LIKE 'Handler_read_next';
+Variable_name Value
+Handler_read_next 1
+DROP TABLE t1, t2;
End of 5.1 tests
Bug#50888 valgrind warnings in Field_timestamp::val_str
@@ -540,3 +603,32 @@ a
2010-03-05 11:08:02
DROP TABLE t1;
End of Bug#50888
+#
+# Bug59330: Incorrect result when comparing an aggregate
+# function with TIMESTAMP
+#
+CREATE TABLE t1 (dt DATETIME, ts TIMESTAMP);
+INSERT INTO t1 VALUES('2011-01-06 12:34:30', '2011-01-06 12:34:30');
+SELECT MAX(dt), MAX(ts) FROM t1;
+MAX(dt) MAX(ts)
+2011-01-06 12:34:30 2011-01-06 12:34:30
+SELECT MAX(ts) < '2010-01-01 00:00:00' FROM t1;
+MAX(ts) < '2010-01-01 00:00:00'
+0
+SELECT MAX(dt) < '2010-01-01 00:00:00' FROM t1;
+MAX(dt) < '2010-01-01 00:00:00'
+0
+SELECT MAX(ts) > '2010-01-01 00:00:00' FROM t1;
+MAX(ts) > '2010-01-01 00:00:00'
+1
+SELECT MAX(dt) > '2010-01-01 00:00:00' FROM t1;
+MAX(dt) > '2010-01-01 00:00:00'
+1
+SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1;
+MAX(ts) = '2011-01-06 12:34:30'
+1
+SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1;
+MAX(dt) = '2011-01-06 12:34:30'
+1
+DROP TABLE t1;
+End of 5.5 tests
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 8948214f565..2dc491c6166 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -341,4 +341,18 @@ ta_y s tb_y s
2001 2001 2001 2001
DROP TABLE t1;
#
+# Bug #59211: Select Returns Different Value for min(year) Function
+#
+CREATE TABLE t1(c1 YEAR(4));
+INSERT INTO t1 VALUES (1901),(2155),(0000);
+SELECT * FROM t1;
+c1
+1901
+2155
+0000
+SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1;
+total_rows min_value MAX(c1)
+3 0 2155
+DROP TABLE t1;
+#
End of 5.1 tests
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index d1342098329..bcf4df8e12c 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1644,3 +1644,128 @@ b
2
DROP TABLE t1,t2;
End of 5.1 tests
+#
+# Bug#57986 ORDER BY clause is not used after a UNION,
+# if embedded in a SELECT
+#
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
+CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
+INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
+INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1;
+c1 c2
+t1a 1
+t1b 1
+t2a 1
+t2b 1
+t1a 2
+t1b 2
+t2a 2
+t2b 2
+t1a 3
+t2a 3
+SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1;
+c1 c2
+t1a 1
+t1b 1
+t2a 1
+t2b 1
+t1a 2
+t1b 2
+t2a 2
+t2b 2
+t1a 3
+t2a 3
+SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1);
+c1 c2
+t1a 1
+t1a 2
+t1a 3
+t1b 2
+t1b 1
+t2a 1
+t2a 2
+t2a 3
+t2b 2
+t2b 1
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+(SELECT c1, c2 FROM t2)
+ORDER BY c2, c1
+) AS res;
+c1 c2
+t1a 1
+t1b 1
+t2a 1
+t2b 1
+t1a 2
+t1b 2
+t2a 2
+t2b 2
+t1a 3
+t2a 3
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+(SELECT c1, c2 FROM t2)
+ORDER BY c2 DESC, c1 LIMIT 1
+) AS res;
+c1 c2
+t1a 3
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+(SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1)
+) AS res;
+c1 c2
+t1a 1
+t1a 2
+t1a 3
+t1b 2
+t1b 1
+t2a 3
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+SELECT c1, c2 FROM t2
+ORDER BY c2 DESC, c1 DESC LIMIT 1
+) AS res;
+c1 c2
+t2a 3
+SELECT c1, c2 FROM (
+(
+(SELECT c1, c2 FROM t1)
+UNION
+(SELECT c1, c2 FROM t2)
+)
+ORDER BY c2 DESC, c1 ASC LIMIT 1
+) AS res;
+c1 c2
+t1a 3
+DROP TABLE t1, t2;
+#
+# Bug #58970 Problem Subquery (without referencing a table)
+# and Order By
+#
+SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev;
+dev
+0
+SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev;
+dev
+1
+SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev;
+dev
+0
+SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+dev
+1
+SELECT(SELECT 1 AS a ORDER BY a) AS dev;
+dev
+1
+SELECT(SELECT 1 AS a LIMIT 1) AS dev;
+dev
+1
+SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+dev
+1
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index a680e837cae..589186184c3 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -445,6 +445,15 @@ IF(
count(*), 1)
1
DROP TABLE t1;
+select @v:=@v:=sum(1) from dual;
+@v:=@v:=sum(1)
+1
+CREATE TABLE t1(a DECIMAL(31,21));
+INSERT INTO t1 VALUES (0);
+SELECT (@v:=a) <> (@v:=1) FROM t1;
+(@v:=a) <> (@v:=1)
+1
+DROP TABLE t1;
End of 5.1 tests
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
diff --git a/mysql-test/r/variables-big.result b/mysql-test/r/variables-big.result
index 960fc6d22f4..02908502c8b 100644
--- a/mysql-test/r/variables-big.result
+++ b/mysql-test/r/variables-big.result
@@ -1,20 +1,22 @@
+SET @def_var= @@session.transaction_prealloc_size;
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
+SET @@session.transaction_prealloc_size= @def_var;
diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result
index 8c6d54757ed..ceac676589f 100644
--- a/mysql-test/r/variables-notembedded.result
+++ b/mysql-test/r/variables-notembedded.result
@@ -108,3 +108,27 @@ SET @@session.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
SET @@global.slave_skip_errors= 7;
ERROR HY000: Variable 'slave_skip_errors' is a read only variable
+#
+# Bug #11766769 : 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET
+# ARE NOT BEING HONORED
+#
+CREATE TABLE t1 (a MEDIUMTEXT);
+SET GLOBAL max_allowed_packet=2048;
+Warnings:
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+SET GLOBAL net_buffer_length=4096;
+Warnings:
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
+Variable_name Value
+max_allowed_packet 2048
+SHOW SESSION VARIABLES LIKE 'net_buffer_length';
+Variable_name Value
+net_buffer_length 4096
+ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
+SELECT LENGTH(a) FROM t1;
+LENGTH(a)
+SET GLOBAL max_allowed_packet=default;
+SET GLOBAL net_buffer_length=default;
+DROP TABLE t1;
+End of 5.1 tests
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index ba27802bce3..29f477fcfd2 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -501,6 +501,7 @@ set low_priority_updates=1;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global max_binlog_cache_size=100;
Warnings:
Warning 1292 Truncated incorrect max_binlog_cache_size value: '100'
@@ -1048,6 +1049,8 @@ set global max_write_lock_count =default;
set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
set global net_buffer_length =@my_net_buffer_length;
+Warnings:
+Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global net_write_timeout =@my_net_write_timeout;
set global net_read_timeout =@my_net_read_timeout;
set global rpl_recovery_rank =@my_rpl_recovery_rank;
@@ -1499,6 +1502,58 @@ SELECT @@skip_name_resolve;
SHOW VARIABLES LIKE 'skip_name_resolve';
Variable_name Value
skip_name_resolve OFF
+#
+# Bug #43233 : Some server variables are clipped during "update,"
+# not "check" stage
+#
+SET @kbs=@@global.key_buffer_size;
+SET @kcbs=@@global.key_cache_block_size;
+throw errors in STRICT mode
+SET SQL_MODE=STRICT_ALL_TABLES;
+SET @@global.max_binlog_cache_size=-1;
+ERROR 42000: Variable 'max_binlog_cache_size' can't be set to the value of '-1'
+SET @@global.max_join_size=0;
+ERROR 42000: Variable 'max_join_size' can't be set to the value of '0'
+SET @@global.key_buffer_size=0;
+ERROR HY000: Cannot drop default keycache
+SET @@global.key_cache_block_size=0;
+ERROR 42000: Variable 'key_cache_block_size' can't be set to the value of '0'
+throw warnings in default mode
+SET SQL_MODE=DEFAULT;
+SET @@global.max_binlog_cache_size=-1;
+Warnings:
+Warning 1292 Truncated incorrect max_binlog_cache_size value: '-1'
+SET @@global.max_join_size=0;
+Warnings:
+Warning 1292 Truncated incorrect max_join_size value: '0'
+SET @@global.key_buffer_size=0;
+ERROR HY000: Cannot drop default keycache
+SET @@global.key_cache_block_size=0;
+Warnings:
+Warning 1292 Truncated incorrect key_cache_block_size value: '0'
+select @@max_long_data_size;
+@@max_long_data_size
+1048576
+#
+# Bug#11766424 59527: DECIMAL_BIN_SIZE: ASSERTION `SCALE >= 0 && PRECISION > 0 && SCALE <= PRE
+#
+CREATE TABLE t1(f1 DECIMAL(1,1) UNSIGNED);
+INSERT INTO t1 VALUES (0.2),(0.1);
+SELECT 1 FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE @a=f1);
+1
+1
+DROP TABLE t1;
+CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(1) unsigned NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET @@global.max_binlog_cache_size=DEFAULT;
+SET @@global.max_join_size=DEFAULT;
+SET @@global.key_buffer_size=@kbs;
+SET @@global.key_cache_block_size=@kcbs;
End of 5.1 tests
#
@@ -1687,3 +1742,25 @@ set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
drop table t1;
drop function t1_min;
drop function t1_max;
+#
+# Bug #59884: setting charset to 2048 crashes
+#
+set session character_set_results = 2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_client=2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_connection=2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_server=2048;
+ERROR 42000: Unknown character set: '2048'
+set session collation_server=2048;
+ERROR HY000: Unknown collation: '2048'
+set session character_set_filesystem=2048;
+ERROR 42000: Unknown character set: '2048'
+set session character_set_database=2048;
+ERROR 42000: Unknown character set: '2048'
+set session collation_connection=2048;
+ERROR HY000: Unknown collation: '2048'
+set session collation_database=2048;
+ERROR HY000: Unknown collation: '2048'
+End of 5.5 tests
diff --git a/mysql-test/r/variables_debug.result b/mysql-test/r/variables_debug.result
index a823c6778a0..63592b2146c 100644
--- a/mysql-test/r/variables_debug.result
+++ b/mysql-test/r/variables_debug.result
@@ -45,3 +45,47 @@ SELECT @@debug;
SET @@debug = @old_local_debug;
End of 5.1 tests
+#
+# Bug#46165 server crash in dbug
+#
+SET @old_globaldebug = @@global.debug;
+SET @old_sessiondebug= @@session.debug;
+# Test 1 - Bug test case, single connection
+SET GLOBAL debug= '+O,../../log/bug46165.1.trace';
+SET SESSION debug= '-d:-t:-i';
+SET GLOBAL debug= '';
+SET SESSION debug= '';
+# Test 2 - Bug test case, two connections
+# Connection default
+SET GLOBAL debug= '+O,../../log/bug46165.2.trace';
+SET SESSION debug= '-d:-t:-i';
+# Connection con1
+SET GLOBAL debug= '';
+# Connection default
+SET SESSION debug= '';
+# Connection con1
+# Connection default
+SET GLOBAL debug= '';
+# Test 3 - Active session trace file on disconnect
+# Connection con1
+SET GLOBAL debug= '+O,../../log/bug46165.3.trace';
+SET SESSION debug= '-d:-t:-i';
+SET GLOBAL debug= '';
+# Test 4 - Active session trace file on two connections
+# Connection default
+SET GLOBAL debug= '+O,../../log/bug46165.4.trace';
+SET SESSION debug= '-d:-t:-i';
+# Connection con1
+SET SESSION debug= '-d:-t:-i';
+SET GLOBAL debug= '';
+SET SESSION debug= '';
+# Connection default
+SET SESSION debug= '';
+# Connection con1
+# Connection default
+# Test 5 - Different trace files
+SET SESSION debug= '+O,../../log/bug46165.5.trace';
+SET SESSION debug= '+O,../../log/bug46165.6.trace';
+SET SESSION debug= '-O';
+SET GLOBAL debug= @old_globaldebug;
+SET SESSION debug= @old_sessiondebug;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index f4c93ddb36d..fff10b73469 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -840,6 +840,8 @@ show table status;
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
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+Warnings:
+Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
drop table t1;
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
@@ -3997,6 +3999,28 @@ CREATE VIEW v1 AS SELECT 1 from t1
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug#57703 create view cause Assertion failed: 0, file .\item_subselect.cc, line 846
+#
+CREATE TABLE t1(a int);
+CREATE VIEW v1 AS SELECT 1 FROM t1 GROUP BY
+SUBSTRING(1 FROM (SELECT 3 FROM t1 WHERE a >= ANY(SELECT 1)));
+DROP VIEW v1;
+DROP TABLE t1;
+#
+# Bug#57352 valgrind warnings when creating view
+#
+CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
+DROP VIEW v1;
+#
+# Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
+#
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
+SELECT * FROM v1;
+a
+DROP VIEW v1;
+DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 1412df20012..9a0408bc174 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -1248,3 +1248,129 @@ Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist
LOCK TABLES v1 READ;
ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist
DROP VIEW v1;
+#
+# Bug #58499 "DEFINER-security view selecting from INVOKER-security view
+# access check wrong".
+#
+# Check that we correctly handle privileges for various combinations
+# of INVOKER and DEFINER-security views using each other.
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+USE mysqltest1;
+CREATE TABLE t1 (i INT);
+CREATE TABLE t2 (j INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+#
+# 1) DEFINER-security view uses INVOKER-security view (covers
+# scenario originally described in the bug report).
+CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1;
+CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2;
+CREATE USER 'mysqluser1'@'%';
+GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%';
+GRANT SELECT ON t1 TO 'mysqluser1'@'%';
+# To be able create 'v2_uses_t2' we also need select on t2.
+GRANT SELECT ON t2 TO 'mysqluser1'@'%';
+GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%';
+GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%';
+#
+# Connection 'mysqluser1'.
+CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
+CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
+#
+# Connection 'default'.
+CREATE USER 'mysqluser2'@'%';
+GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%';
+GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%';
+GRANT SELECT ON t2 TO 'mysqluser2'@'%';
+GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%';
+# Make 'mysqluser1' unable to access t2.
+REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
+#
+# Connection 'mysqluser2'.
+# The below statement should succeed thanks to suid nature of v2_uses_t1.
+SELECT * FROM v2_uses_t1;
+i
+1
+# The below statement should fail due to suid nature of v2_uses_t2.
+SELECT * FROM v2_uses_t2;
+ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+#
+# 2) INVOKER-security view uses INVOKER-security view.
+#
+# Connection 'default'.
+DROP VIEW v2_uses_t1, v2_uses_t2;
+CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
+CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
+GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%';
+GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%';
+GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%';
+GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%';
+#
+# Connection 'mysqluser1'.
+# For both versions of 'v2' 'mysqluser1' privileges should be used.
+SELECT * FROM v2_uses_t1;
+i
+1
+SELECT * FROM v2_uses_t2;
+ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+#
+# Connection 'mysqluser2'.
+# And now for both versions of 'v2' 'mysqluser2' privileges should
+# be used.
+SELECT * FROM v2_uses_t1;
+ERROR HY000: View 'mysqltest1.v2_uses_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+SELECT * FROM v2_uses_t2;
+j
+2
+#
+# 3) INVOKER-security view uses DEFINER-security view.
+#
+# Connection 'default'.
+DROP VIEW v1_uses_t1, v1_uses_t2;
+# To be able create 'v1_uses_t2' we also need select on t2.
+GRANT SELECT ON t2 TO 'mysqluser1'@'%';
+#
+# Connection 'mysqluser1'.
+CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1;
+CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2;
+#
+# Connection 'default'.
+# Make 'mysqluser1' unable to access t2.
+REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
+#
+# Connection 'mysqluser2'.
+# Due to suid nature of v1_uses_t1 and v1_uses_t2 the first
+# select should succeed and the second select should fail.
+SELECT * FROM v2_uses_t1;
+i
+1
+SELECT * FROM v2_uses_t2;
+ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+#
+# 4) DEFINER-security view uses DEFINER-security view.
+#
+# Connection 'default'.
+DROP VIEW v2_uses_t1, v2_uses_t2;
+# To be able create 'v2_uses_t2' we also need select on t2.
+GRANT SELECT ON t2 TO 'mysqluser1'@'%';
+#
+# Connection 'mysqluser2'.
+CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
+CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
+#
+# Connection 'default'.
+# Make 'mysqluser1' unable to access t2.
+REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
+#
+# Connection 'mysqluser2'.
+# Again privileges of creator of innermost views should apply.
+SELECT * FROM v2_uses_t1;
+i
+1
+SELECT * FROM v2_uses_t2;
+ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+USE test;
+DROP DATABASE mysqltest1;
+DROP USER 'mysqluser1'@'%';
+DROP USER 'mysqluser2'@'%';
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 611e807ce8e..0f2d12d86c9 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -330,3 +330,25 @@ Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 4
drop table t1;
End of 5.1 tests
+
+-- Bug#55847
+
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1(a INT UNIQUE);
+CREATE FUNCTION f1(x INT) RETURNS INT
+BEGIN
+INSERT INTO t1 VALUES(x);
+INSERT INTO t1 VALUES(x);
+RETURN x;
+END|
+
+SHOW TABLES WHERE f1(11) = 11;
+ERROR 23000: Duplicate entry '11' for key 'a'
+
+SHOW WARNINGS;
+Level Code Message
+Error 1062 Duplicate entry '11' for key 'a'
+
+DROP TABLE t1;
+DROP FUNCTION f1;
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index fedbb43ea2a..7b580abb19f 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -131,3 +131,101 @@ XA START 'xid1';
XA END 'xid1';
XA ROLLBACK 'xid1';
DROP TABLE t1;
+#
+# Bug#56448 Assertion failed: ! is_set() with second xa end
+#
+XA START 'x';
+XA END 'x';
+XA END 'x';
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+XA PREPARE 'x';
+XA PREPARE 'x';
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+XA ROLLBACK 'x';
+#
+# Bug#59986 Assert in Diagnostics_area::set_ok_status() for XA COMMIT
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB;
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+# Connection con1
+XA START 'a';
+UPDATE t1 SET b= 3 WHERE a=1;
+# Connection default
+XA START 'b';
+UPDATE t1 SET b=4 WHERE a=2;
+# Sending:
+UPDATE t1 SET b=5 WHERE a=1;
+# Connection con1
+UPDATE t1 SET b=6 WHERE a=2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+XA COMMIT 'a';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+# Connection default
+# Reaping: UPDATE t1 SET b=5 WHERE a=1
+XA END 'b';
+XA ROLLBACK 'b';
+DROP TABLE t1;
+#
+# Bug#11766752 59936: multiple xa assertions - transactional
+# statement fuzzer
+#
+CREATE TABLE t1 (a INT) engine=InnoDB;
+XA START 'a';
+INSERT INTO t1 VALUES (1);
+SAVEPOINT savep;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
+XA END 'a';
+SELECT * FROM t1;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+INSERT INTO t1 VALUES (2);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+SAVEPOINT savep;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+SET @a=(SELECT * FROM t1);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the IDLE state
+XA PREPARE 'a';
+SELECT * FROM t1;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+INSERT INTO t1 VALUES (2);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+SAVEPOINT savep;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+SET @a=(SELECT * FROM t1);
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+UPDATE t1 SET a=1 WHERE a=2;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+XA COMMIT 'a';
+SELECT * FROM t1;
+a
+1
+DROP TABLE t1;
+#
+# Bug#12352846 - TRANS_XA_START(THD*):
+# ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
+# FAILED
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+# Connection con2
+XA START 'xid1';
+# Sending:
+INSERT INTO t2 SELECT a FROM t1;
+# Connection default
+# Waiting until INSERT ... is blocked
+DELETE FROM t1;
+COMMIT;
+# Connection con2
+# Reaping: INSERT INTO t2 SELECT a FROM t1
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+XA COMMIT 'xid1';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+XA START 'xid1';
+XA END 'xid1';
+XA PREPARE 'xid1';
+XA ROLLBACK 'xid1';
+# Connection default
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index fad2cab0e57..8ca9ab84bf7 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1093,4 +1093,56 @@ Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
DROP TABLE t1;
+#
+# Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
+#
+SET NAMES utf8;
+SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds','');
+REPLACE(EXTRACTVALUE('1', '/a'),'ds','')
+
+#
+# Bug #57820 extractvalue crashes
+#
+SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k')));
+AVG(DISTINCT EXTRACTVALUE((''),('$@k')))
+NULL
+#
+# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
+#
+SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
+SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
+#
+# Bug #44332 my_xml_scan reads behind the end of buffer
+#
+SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1');
+UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1')
+NULL
+Warnings:
+Warning 1525 Incorrect XML value: 'parse error at line 1 pos 2: END-OF-INPUT unexpected (ident or '/' wanted)'
+SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1');
+UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1')
+NULL
+#
+# Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332
+#
+SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1);
+ExtractValue(CONVERT('<\"', BINARY(10)), 1)
+NULL
+Warnings:
+Warning 1525 Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected (ident or '/' wanted)'
End of 5.1 tests
+#
+# Start of 5.5 tests
+#
+#
+# Bug#58175 xml functions read initialized bytes when conversions happen
+#
+SET NAMES latin1;
+SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
+UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
+NULL
+#
+# End of 5.5 tests
+#