summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/binlog_index.test69
-rw-r--r--mysql-test/t/change_user.test7
-rw-r--r--mysql-test/t/compare.test31
-rw-r--r--mysql-test/t/connect.test190
-rw-r--r--mysql-test/t/create.test74
-rw-r--r--mysql-test/t/csv.test11
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test10
-rw-r--r--mysql-test/t/ctype_ucs.test4
-rw-r--r--mysql-test/t/ctype_ucs2_def.test13
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/distinct.test23
-rw-r--r--mysql-test/t/drop.test49
-rw-r--r--mysql-test/t/flush.test9
-rw-r--r--mysql-test/t/flush_read_lock_kill.test5
-rw-r--r--mysql-test/t/func_gconcat.test17
-rw-r--r--mysql-test/t/func_group.test10
-rw-r--r--mysql-test/t/func_math.test14
-rw-r--r--mysql-test/t/func_misc.test24
-rw-r--r--mysql-test/t/func_str.test7
-rw-r--r--mysql-test/t/func_time.test27
-rw-r--r--mysql-test/t/grant.test62
-rw-r--r--mysql-test/t/grant3.test26
-rw-r--r--mysql-test/t/group_by.test117
-rw-r--r--mysql-test/t/information_schema.test72
-rw-r--r--mysql-test/t/information_schema_inno.test13
-rw-r--r--mysql-test/t/innodb.test23
-rw-r--r--mysql-test/t/kill.test7
-rw-r--r--mysql-test/t/loaddata.test82
-rw-r--r--mysql-test/t/log_tables.test10
-rw-r--r--mysql-test/t/merge-big.test84
-rw-r--r--mysql-test/t/merge.test13
-rw-r--r--mysql-test/t/myisam.test184
-rw-r--r--mysql-test/t/mysqldump-no-binlog-master.opt1
-rw-r--r--mysql-test/t/mysqldump-no-binlog.test6
-rw-r--r--mysql-test/t/null_key.test23
-rw-r--r--mysql-test/t/order_by.test473
-rw-r--r--mysql-test/t/partition.test86
-rw-r--r--mysql-test/t/partition_datatype.test65
-rw-r--r--mysql-test/t/partition_error.test18
-rw-r--r--mysql-test/t/partition_innodb.test7
-rw-r--r--mysql-test/t/partition_not_windows.test212
-rw-r--r--mysql-test/t/partition_range.test45
-rw-r--r--mysql-test/t/partition_symlink.test95
-rw-r--r--mysql-test/t/partition_windows.test37
-rw-r--r--mysql-test/t/plugin.test35
-rw-r--r--mysql-test/t/plugin_load-master.opt3
-rw-r--r--mysql-test/t/plugin_load.test3
-rw-r--r--mysql-test/t/query_cache.test28
-rw-r--r--mysql-test/t/range.test63
-rw-r--r--mysql-test/t/row.test13
-rw-r--r--mysql-test/t/select.test29
-rw-r--r--mysql-test/t/sp-code.test32
-rw-r--r--mysql-test/t/sp-error.test26
-rw-r--r--mysql-test/t/sp.test19
-rw-r--r--mysql-test/t/sp_notembedded.test141
-rw-r--r--mysql-test/t/sql_mode.test29
-rw-r--r--mysql-test/t/strict.test1
-rw-r--r--mysql-test/t/subselect3.test19
-rw-r--r--mysql-test/t/subselect_notembedded.test126
-rw-r--r--mysql-test/t/symlink.test130
-rw-r--r--mysql-test/t/tablelock.test13
-rw-r--r--mysql-test/t/temp_table.test14
-rw-r--r--mysql-test/t/trigger-trans.test32
-rw-r--r--mysql-test/t/type_set.test20
-rw-r--r--mysql-test/t/view.test58
-rw-r--r--mysql-test/t/warnings.test33
66 files changed, 2745 insertions, 478 deletions
diff --git a/mysql-test/t/binlog_index.test b/mysql-test/t/binlog_index.test
new file mode 100644
index 00000000000..1e44a9b02e2
--- /dev/null
+++ b/mysql-test/t/binlog_index.test
@@ -0,0 +1,69 @@
+#
+# testing of purging of binary log files bug#18199/Bug#18453
+#
+source include/have_log_bin.inc;
+source include/not_embedded.inc;
+
+#
+# testing purge binary logs TO
+#
+
+flush logs;
+flush logs;
+flush logs;
+
+source include/show_binary_logs.inc;
+
+remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+# there must be a warning with file names
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+purge binary logs TO 'master-bin.000004';
+
+--echo *** must show a list starting from the 'TO' argument of PURGE ***
+source include/show_binary_logs.inc;
+
+#
+# testing purge binary logs BEFORE
+#
+
+reset master;
+
+flush logs;
+flush logs;
+flush logs;
+remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+--echo *** must be a warning master-bin.000001 was not found ***
+let $date=`select NOW() + INTERVAL 1 MINUTE`;
+--disable_query_log
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval purge binary logs BEFORE '$date';
+--enable_query_log
+
+--echo *** must show one record, of the active binlog, left in the index file after PURGE ***
+source include/show_binary_logs.inc;
+
+#
+# testing a fatal error
+# Turning a binlog file into a directory must be a portable setup
+#
+
+reset master;
+
+flush logs;
+flush logs;
+flush logs;
+
+remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+mkdir $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+--error ER_BINLOG_PURGE_FATAL_ERR
+purge binary logs TO 'master-bin.000002';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show warnings;
+rmdir $MYSQLTEST_VARDIR/log/master-bin.000001;
+--disable_warnings
+reset master;
+--enable_warnings
+--echo End of tests
diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test
index 82aeb4da4af..f200c76196c 100644
--- a/mysql-test/t/change_user.test
+++ b/mysql-test/t/change_user.test
@@ -4,17 +4,24 @@
--echo Bug#20023
SELECT @@session.sql_big_selects;
+# The exact value depends on the server build flags
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
SELECT @@global.max_join_size;
--echo change_user
--change_user
SELECT @@session.sql_big_selects;
+# The exact value depends on the server build flags
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
SELECT @@global.max_join_size;
SET @@global.max_join_size = 10000;
SET @@session.max_join_size = default;
--echo change_user
--change_user
SELECT @@session.sql_big_selects;
+# On some machines the following will result into a warning
+--disable_warnings
SET @@global.max_join_size = -1;
+--enable_warnings
SET @@session.max_join_size = default;
--echo change_user
--change_user
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index 337035a8095..8863ed825c2 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -46,3 +46,34 @@ insert into t1 values (0x01,0x01);
select * from t1 where a=b;
select * from t1 where a=b and b=0x01;
drop table if exists t1;
+
+#
+# Bug #31887: DML Select statement not returning same results when executed
+# in version 5
+#
+
+CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
+INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
+
+SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
+
+EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
+SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
+
+CREATE TABLE t2 (a int);
+INSERT INTO t2 VALUES (1),(2);
+
+SELECT a,
+ (SELECT COUNT(*) FROM t1
+ WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
+FROM t2 ORDER BY a;
+
+EXPLAIN EXTENDED
+SELECT a,
+ (SELECT COUNT(*) FROM t1
+ WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
+FROM t2 ORDER BY a;
+
+DROP TABLE t1,t2;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 2e66c24d877..0893bf9ad18 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -102,4 +102,192 @@ disconnect con7;
connection default;
drop table t1;
-# End of 4.1 tests
+--disconnect con1
+--disconnect con2
+--disconnect con3
+--disconnect con4
+--disconnect con5
+--disconnect con6
+--disconnect con10
+
+--echo # ------------------------------------------------------------------
+--echo # -- End of 4.1 tests
+--echo # ------------------------------------------------------------------
+
+###########################################################################
+
+--echo
+--echo # -- Bug#33507: Event scheduler creates more threads than max_connections
+--echo # -- which results in user lockout.
+
+--echo
+GRANT USAGE ON *.* TO mysqltest_u1@localhost;
+
+# NOTE: if the test case fails sporadically due to spurious connections,
+# consider disabling all users.
+
+--echo
+let $saved_max_connections = `SELECT @@global.max_connections`;
+SET GLOBAL max_connections = 3;
+SET GLOBAL event_scheduler = ON;
+
+--echo
+--echo # -- Waiting for Event Scheduler to start...
+let $wait_condition =
+ SELECT COUNT(*) = 1
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
+--echo
+--echo # -- Disconnecting default connection...
+--disconnect default
+
+--echo
+--echo # -- Check that we allow exactly three user connections, no matter how
+--echo # -- many threads are running.
+
+--echo
+--echo # -- Connecting (1)...
+let $con_name = con_1;
+let $con_user_name = mysqltest_u1;
+--source include/connect2.inc
+
+--echo
+--echo # -- Connecting (2)...
+let $con_name = con_2;
+let $con_user_name = mysqltest_u1;
+--source include/connect2.inc
+
+--echo
+--echo # -- Connecting (3)...
+let $con_name = con_3;
+let $con_user_name = mysqltest_u1;
+--source include/connect2.inc
+
+--echo
+--echo # -- Connecting (4) [should fail]...
+let $con_name = con_4;
+let $con_user_name = mysqltest_u1;
+let $wait_timeout = 5;
+--source include/connect2.inc
+
+--echo
+--echo # -- Check that we allow one extra SUPER-user connection.
+
+--echo
+--echo # -- Connecting super (1)...
+let $con_name = con_super_1;
+let $con_user_name = root;
+--source include/connect2.inc
+
+--echo
+--echo # -- Connecting super (2) [should fail]...
+let $con_name = con_super_2;
+let $con_user_name = root;
+let $wait_timeout = 5;
+--source include/connect2.inc
+
+--echo
+--echo # -- Ensure that we have Event Scheduler thread, 3 ordinary user
+--echo # -- connections and one extra super-user connection.
+SELECT user FROM information_schema.processlist ORDER BY id;
+
+--echo
+--echo # -- Resetting variables...
+--eval SET GLOBAL max_connections = $saved_max_connections
+
+--echo
+--echo # -- Stopping Event Scheduler...
+SET GLOBAL event_scheduler = OFF;
+
+--echo
+--echo # -- Waiting for Event Scheduler to stop...
+let $wait_condition =
+ SELECT COUNT(*) = 0
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
+--echo
+--echo # -- That's it. Closing connections...
+--disconnect con_1
+--disconnect con_2
+--disconnect con_3
+--disconnect con_super_1
+
+--echo
+--echo # -- Restoring default connection...
+--connect (default,localhost,root,,test)
+
+--echo
+--echo # -- Waiting for connections to close...
+let $wait_condition =
+ SELECT COUNT(*) = 1
+ FROM information_schema.processlist
+ WHERE db = 'test';
+--source include/wait_condition.inc
+
+--echo
+DROP USER mysqltest_u1@localhost;
+
+--echo
+--echo # -- End of Bug#33507.
+--echo
+
+###########################################################################
+
+--echo # -- Bug#35074: max_used_connections is not correct.
+--echo
+
+FLUSH STATUS;
+
+--echo
+SHOW STATUS LIKE 'max_used_connections';
+
+--echo
+--echo # -- Starting Event Scheduler...
+SET GLOBAL event_scheduler = ON;
+
+--echo # -- Waiting for Event Scheduler to start...
+let $wait_condition =
+ SELECT COUNT(*) = 1
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
+# NOTE: We should use a new connection here instead of reconnect in order to
+# avoid races (we can not for sure when the connection being disconnected is
+# actually disconnected on the server).
+
+--echo
+--echo # -- Opening a new connection to check max_used_connections...
+--connect (con_1,localhost,root)
+
+--echo
+--echo # -- Check that max_used_connections hasn't changed.
+SHOW STATUS LIKE 'max_used_connections';
+
+--echo
+--echo # -- Closing new connection...
+--disconnect con_1
+--connection default
+
+--echo
+--echo # -- Stopping Event Scheduler...
+SET GLOBAL event_scheduler = OFF;
+
+--echo # -- Waiting for Event Scheduler to stop...
+let $wait_condition =
+ SELECT COUNT(*) = 0
+ FROM information_schema.processlist
+ WHERE user = 'event_scheduler';
+--source include/wait_condition.inc
+
+--echo
+--echo # -- End of Bug#35074.
+--echo
+
+--echo # ------------------------------------------------------------------
+--echo # -- End of 5.1 tests
+--echo # ------------------------------------------------------------------
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index e86951f317f..4c76cbb7588 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1152,6 +1152,30 @@ create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
show status like 'handler_read%';
drop table t1,t2;
+#
+# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates
+#
+
+# Show that the old syntax for index type is supported
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
+DROP TABLE t1;
+
+# Show that the new syntax for index type is supported
+CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
+DROP TABLE t1;
+
+# Show that in case of multiple index type definitions, the last one takes
+# precedence
+
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
+SHOW INDEX FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
+SHOW INDEX FROM t1;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
#
@@ -1341,6 +1365,8 @@ create table t1 like information_schema.character_sets;
show create table t1;
drop table t1;
+###########################################################################
+
--echo
--echo # --
--echo # -- Bug#21380: DEFAULT definition not always transfered by CREATE
@@ -1384,8 +1410,10 @@ DROP TABLE t1;
--echo
--echo # -- End of test case for Bug#21380.
---echo
+###########################################################################
+
+--echo
--echo # --
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
--echo # --
@@ -1448,6 +1476,50 @@ DROP TABLE t3;
--echo
--echo # -- End of Bug#18834.
+
+###########################################################################
+
--echo
+--echo # --
+--echo # -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type.
+--echo # --
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--echo
+CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);
+
+--echo
+SHOW CREATE TABLE t1;
+
+--echo
+INSERT INTO t1 VALUES();
+
+--echo
+SELECT * FROM t1;
+
+--echo
+ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;
+
+--echo
+SHOW CREATE TABLE t1;
+
+--echo
+INSERT INTO t1 VALUES();
+
+--echo
+SELECT * FROM t1;
+
+--echo
+DROP TABLE t1;
+
+--echo
+--echo # -- End of Bug#34274
+
+###########################################################################
+
+--echo
--echo End of 5.1 tests
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 78cba55acc6..d2a00979dc8 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1774,4 +1774,15 @@ drop table t1;
CREATE TABLE t1(a INT) ENGINE=CSV;
SHOW WARNINGS;
+#
+# BUG#33067 - .
+#
+create table t1 (c1 tinyblob not null) engine=csv;
+insert into t1 values("This");
+--enable_info
+update t1 set c1="That" where c1="This";
+--disable_info
+select * from t1;
+drop table t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
index 7b7018d5901..1fb656f2a01 100644
--- a/mysql-test/t/ctype_cp1250_ch.test
+++ b/mysql-test/t/ctype_cp1250_ch.test
@@ -9,6 +9,16 @@ DROP TABLE IF EXISTS t1;
SHOW COLLATION LIKE 'cp1250_czech_cs';
+SET @test_character_set= 'cp1250';
+SET @test_collation= 'cp1250_general_ci';
+-- source include/ctype_common.inc
+
+SET @test_character_set= 'cp1250';
+SET @test_collation= 'cp1250_czech_cs';
+-- source include/ctype_common.inc
+
+
+
#
# Bugs: #8840: Empty string comparison and character set 'cp1250'
#
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 529c48a627b..db609777c8d 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -4,6 +4,10 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
+SET @test_character_set= 'ucs2';
+SET @test_collation= 'ucs2_general_ci';
+-- source include/ctype_common.inc
+
SET NAMES latin1;
SET character_set_connection=ucs2;
-- source include/endspace.inc
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
index c80444daddd..b146dc63626 100644
--- a/mysql-test/t/ctype_ucs2_def.test
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -39,4 +39,17 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
INSERT INTO t1 VALUES('A ', 'A ');
DROP TABLE t1;
+#
+# Bug#32705 - myisam corruption: Key in wrong position
+# at page 1024 with ucs2_bin
+#
+CREATE TABLE t1 (
+ c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
+ KEY(c1)
+ ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('marshall\'s');
+INSERT INTO t1 VALUES ('marsh');
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index c4a1a75d948..89979ef8dee 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -15,7 +15,6 @@ concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random
federated_transactions : Bug#29523 Transactions do not work
lowercase_table3 : Bug#32667 lowercase_table3.test reports to error log
innodb_mysql : Bug#32724: innodb_mysql.test fails randomly
-wait_timeout : Bug#32801 wait_timeout.test fails randomly
ctype_create : Bug#32965 main.ctype_create fails
status : Bug#32966 main.status fails
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 60715c8e9cc..21c872ed8ea 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -553,3 +553,26 @@ SELECT DISTINCT a, a, b FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests
+
+#
+# Bug #34928: Confusion by having Primary Key and Index
+#
+CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
+ PRIMARY KEY(a,b,c,d,e),
+ KEY(a,b,d,c)
+);
+
+INSERT INTO t1(a, b, c) VALUES (1, 1, 1),
+ (1, 1, 2),
+ (1, 1, 3),
+ (1, 2, 1),
+ (1, 2, 2),
+ (1, 2, 3);
+
+EXPLAIN SELECT DISTINCT a, b, d, c FROM t1;
+
+SELECT DISTINCT a, b, d, c FROM t1;
+
+DROP TABLE t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 2bd37f9ad0d..ef8b59ff1fc 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -135,4 +135,53 @@ let $MYSQLD_DATADIR= `select @@datadir`;
copy_file $MYSQLD_DATADIR/mysql_test/t1.frm $MYSQLD_DATADIR/mysql_test/#sql-347f_6.frm;
drop database mysql_test;
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
+--echo # -- exist.
+--echo # --
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysql_test;
+--enable_warnings
+
+CREATE DATABASE mysql_test;
+
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD
+--copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI
+
+DROP TABLE mysql.proc;
+
+DROP DATABASE mysql_test;
+
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+
+--echo
+--echo # --
+--echo # -- End of Bug#29958.
+--echo # --
+
+###########################################################################
+
+--echo
+#
+# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
+#
+create database mysqltestbug26703;
+use mysqltestbug26703;
+create table `#mysql50#abc``def` ( id int );
+--error ER_WRONG_TABLE_NAME
+create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+--error ER_WRONG_TABLE_NAME
+create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
+use test;
+drop database mysqltestbug26703;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index 794423ca211..c832cb79158 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -164,6 +164,15 @@ drop table t1, t2;
set session low_priority_updates=default;
+#
+# Bug #33334 mysqltest_embedded crashes when disconnecting before reap
+#
+
+connect (con1,localhost,root,,);
+send select benchmark(200, (select sin(1))) > 1000;
+disconnect con1;
+connection default;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test
index c3926d09205..c03f3be2534 100644
--- a/mysql-test/t/flush_read_lock_kill.test
+++ b/mysql-test/t/flush_read_lock_kill.test
@@ -14,6 +14,7 @@
# Disable concurrent inserts to avoid test failures when reading the
# connection id which was inserted into a table by another thread.
+set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
connect (con1,localhost,root,,);
@@ -58,3 +59,7 @@ reap;
connection con2;
drop table t1;
+connection default;
+
+# Restore global concurrent_insert value
+set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 826e00bf74f..1026ca67a43 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -640,4 +640,21 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
DROP TABLE t1, t2, t3;
+#
+# Bug #34747: crash in debug assertion check after derived table
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (),();
+SELECT s1.d1 FROM
+(
+ SELECT
+ t1.a as d1,
+ GROUP_CONCAT(DISTINCT t1.a) AS d2
+ FROM
+ t1 AS t1,
+ t1 AS t2
+ GROUP BY 1
+) AS s1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 36d360780cf..b6143bc0c78 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -923,5 +923,15 @@ DROP VIEW v1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
+#
+# Bug #34512: CAST( AVG( double ) AS DECIMAL ) returns wrong results
+#
+
+CREATE TABLE t1(a DOUBLE);
+INSERT INTO t1 VALUES (10), (20);
+SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
+
+DROP TABLE t1;
+
###
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 274a953a314..87b172a6436 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -248,5 +248,17 @@ INSERT INTO t1 VALUES ('a');
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
DROP TABLE t1;
-
--echo End of 5.0 tests
+
+#
+# Bug #31236: Inconsistent division by zero behavior for floating point numbers
+#
+
+SELECT 1e308 + 1e308;
+SELECT -1e308 - 1e308;
+SELECT 1e300 * 1e300;
+SELECT 1e300 / 1e-300;
+SELECT EXP(750);
+SELECT POW(10, 309);
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 7a579088d23..d33dd9b0d14 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -214,6 +214,24 @@ SELECT NAME_CONST('test', -1.0);
SELECT NAME_CONST('test', 'test');
#
+# Bug #34749: Server crash when using NAME_CONST() with an aggregate function
+#
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+# NAME_CONST() + aggregate.
+SELECT NAME_CONST('flag',1) * MAX(a) FROM t1;
+SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1;
+# Now, wrap the INT_ITEM in Item_func_neg and watch the pretty explosions
+SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1;
+SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
+--error ER_WRONG_ARGUMENTS
+SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
+--error ER_WRONG_ARGUMENTS
+SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
+DROP TABLE t1;
+
+#
# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
# resolved against a column name of a derived table hangs the client
#
@@ -246,6 +264,12 @@ insert into t1 values (-1), (-2);
select min(a) from t1 group by inet_ntoa(a);
drop table t1;
+#
+# BUG#34289 - Incorrect NAME_CONST substitution in stored procedures breaks
+# replication
+#
+SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index b6da14211ae..5a5f4024bc4 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -875,6 +875,13 @@ select benchmark(100, NULL);
select benchmark(NULL, 1+1);
#
+# Bug #20752: BENCHMARK with many iterations returns too quickly
+#
+
+# not a string, but belongs with the above Bug#22684
+select benchmark(-1, 1);
+
+#
# Please note:
# 1) The collation of the password is irrelevant, the encryption uses
# the binary representation of the string without charset/collation.
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 13c5da1285a..c417e9a02bf 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -336,7 +336,7 @@ select date_add(date,INTERVAL "1" QUARTER) from t1;
select timestampadd(MINUTE, 1, date) from t1;
select timestampadd(WEEK, 1, date) from t1;
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
-# Prepared statements doesn't support FRAC_SECOND yet
+# mysqltest.c discards an expected 'deprecated' warning on prepare stage
--disable_ps_protocol
select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
--enable_ps_protocol
@@ -351,7 +351,10 @@ select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a;
select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a;
select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a;
select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a;
+# mysqltest.c discards an expected 'deprecated' warning on prepare stage
+--disable_ps_protocol
select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a;
+--enable_ps_protocol
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
@@ -783,6 +786,28 @@ select DATE_ADD(20071108, INTERVAL 1 DAY);
select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
+#
+# Bug#33834: FRAC_SECOND: Applicability not clear in documentation
+#
+# Show that he use of FRAC_SECOND, for anything other than
+# TIMESTAMPADD / TIMESTAMPDIFF, is a server error.
+
+# mysqltest.c discards an expected 'deprecated' warning on prepare stage
+--disable_ps_protocol
+SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18');
+SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18');
+--enable_ps_protocol
+
+--error ER_PARSE_ERROR
+SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND);
+--error ER_PARSE_ERROR
+SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND);
+
+--error ER_PARSE_ERROR
+SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND;
+--error ER_PARSE_ERROR
+SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index e540ce703a1..d00881bad99 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -1400,4 +1400,66 @@ DROP USER mysqltest_1@localhost;
FLUSH PRIVILEGES;
+#
+# Bug#33464: DROP FUNCTION caused a crash.
+#
+CREATE DATABASE dbbug33464;
+CREATE USER 'userbug33464'@'localhost';
+
+GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
+
+--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
+connect (connbug33464, localhost, userbug33464, , dbbug33464);
+--source suite/funcs_1/include/show_connection.inc
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS sp3;
+DROP FUNCTION IF EXISTS fn1;
+--enable_warnings
+
+delimiter //;
+CREATE PROCEDURE sp3(v1 char(20))
+BEGIN
+ SELECT * from dbbug33464.t6 where t6.f2= 'xyz';
+END//
+delimiter ;//
+
+delimiter //;
+CREATE FUNCTION fn1() returns char(50) SQL SECURITY INVOKER
+BEGIN
+ return 1;
+END//
+delimiter ;//
+
+delimiter //;
+CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER
+BEGIN
+ return 2;
+END//
+delimiter ;//
+
+disconnect connbug33464;
+
+# cleanup
+connection default;
+USE dbbug33464;
+--source suite/funcs_1/include/show_connection.inc
+
+SELECT fn1();
+SELECT fn2();
+
+--error 0, ER_CANNOT_USER
+DROP USER 'userbug33464'@'localhost';
+
+DROP FUNCTION fn1;
+DROP FUNCTION fn2;
+DROP PROCEDURE sp3;
+
+--error 0, ER_CANNOT_USER
+DROP USER 'userbug33464'@'localhost';
+
+use test;
+DROP DATABASE dbbug33464;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/grant3.test b/mysql-test/t/grant3.test
index fac577ef0ff..8eceb851c29 100644
--- a/mysql-test/t/grant3.test
+++ b/mysql-test/t/grant3.test
@@ -134,3 +134,29 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by
DROP USER CUser2@localhost;
DROP USER CUser2@LOCALHOST;
+
+
+#
+# Bug#31194: Privilege ordering does not order properly for wildcard values
+#
+
+CREATE DATABASE mysqltest_1;
+CREATE TABLE mysqltest_1.t1 (a INT);
+CREATE USER 'mysqltest1'@'%';
+GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%';
+REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%';
+GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%';
+FLUSH PRIVILEGES;
+
+connect (conn1,localhost,mysqltest1,,);
+connection conn1;
+SHOW GRANTS;
+SELECT * FROM mysqltest_1.t1;
+disconnect conn1;
+
+connection default;
+DROP USER 'mysqltest1'@'%';
+DROP DATABASE mysqltest_1;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index d5dad3c1032..db50c733129 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -823,6 +823,123 @@ SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC;
DROP TABLE t1;
+--echo #
+--echo # Bug#27219: Aggregate functions in ORDER BY.
+--echo #
+SET @save_sql_mode=@@sql_mode;
+SET @@sql_mode='ONLY_FULL_GROUP_BY';
+
+CREATE TABLE t1 (a INT, b INT, c INT DEFAULT 0);
+INSERT INTO t1 (a, b) VALUES (3,3), (2,2), (3,3), (2,2), (3,3), (4,4);
+CREATE TABLE t2 SELECT * FROM t1;
+
+SELECT 1 FROM t1 ORDER BY COUNT(*);
+SELECT 1 FROM t1 ORDER BY COUNT(*) + 1;
+--error 1140
+SELECT 1 FROM t1 ORDER BY COUNT(*) + a;
+SELECT 1 FROM t1 ORDER BY COUNT(*), 1;
+--error 1140
+SELECT 1 FROM t1 ORDER BY COUNT(*), a;
+
+SELECT 1 FROM t1 ORDER BY SUM(a);
+SELECT 1 FROM t1 ORDER BY SUM(a + 1);
+SELECT 1 FROM t1 ORDER BY SUM(a) + 1;
+--error 1140
+SELECT 1 FROM t1 ORDER BY SUM(a), b;
+
+--error 1140
+SELECT a FROM t1 ORDER BY COUNT(b);
+
+SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2);
+
+--error 1140
+SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a), t2.a FROM t2);
+--error 1140
+SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a);
+--error 1140
+SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
+
+--error 1140
+SELECT t1.a FROM t1
+ WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
+--error 1140
+SELECT t1.a FROM t1 GROUP BY t1.a
+ HAVING t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
+
+SELECT t1.a FROM t1 GROUP BY t1.a
+ HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY SUM(t1.b));
+--error 1140
+SELECT t1.a FROM t1 GROUP BY t1.a
+ HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b));
+--error 1140
+SELECT t1.a FROM t1 GROUP BY t1.a
+ HAVING t1.a > ANY (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b));
+
+--error 1140
+SELECT t1.a FROM t1
+ WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t1.b));
+
+SELECT 1 FROM t1 GROUP BY t1.a
+ HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
+SELECT 1 FROM t1 GROUP BY t1.a
+ HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
+SELECT 1 FROM t1 GROUP BY t1.a
+ HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
+
+--error 1140
+SELECT 1 FROM t1 GROUP BY t1.a
+ HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY t2.a LIMIT 1);
+--error 1140
+SELECT 1 FROM t1 GROUP BY t1.a
+ HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
+--error 1140
+SELECT 1 FROM t1 GROUP BY t1.a
+ HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
+
+# Both SUMs are aggregated in the subquery, no mixture:
+SELECT t1.a FROM t1
+ WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a
+ ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1);
+
+# SUM(t1.b) is aggregated in the subquery, no mixture:
+SELECT t1.a, SUM(t1.b) FROM t1
+ WHERE t1.a = (SELECT SUM(t2.b) FROM t2 GROUP BY t2.a
+ ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1)
+ GROUP BY t1.a;
+
+# 2nd SUM(t1.b) is aggregated in the subquery, no mixture:
+SELECT t1.a, SUM(t1.b) FROM t1
+ WHERE t1.a = (SELECT SUM(t2.b) FROM t2
+ ORDER BY SUM(t2.b) + SUM(t1.b) LIMIT 1)
+ GROUP BY t1.a;
+
+# SUM(t2.b + t1.a) is aggregated in the subquery, no mixture:
+SELECT t1.a, SUM(t1.b) FROM t1
+ WHERE t1.a = (SELECT SUM(t2.b) FROM t2
+ ORDER BY SUM(t2.b + t1.a) LIMIT 1)
+ GROUP BY t1.a;
+
+SELECT t1.a FROM t1 GROUP BY t1.a
+ HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1);
+
+select avg (
+ (select
+ (select sum(outr.a + innr.a) from t1 as innr limit 1) as tt
+ from t1 as outr order by outr.a limit 1))
+from t1 as most_outer;
+
+--error 1140
+select avg (
+ (select (
+ (select sum(outr.a + innr.a) from t1 as innr limit 1)) as tt
+ from t1 as outr order by count(outr.a) limit 1)) as tt
+from t1 as most_outer;
+
+select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a;
+
+SET sql_mode=@save_sql_mode;
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
# Bug #21174: Index degrades sort performance and
# optimizer does not honor IGNORE INDEX.
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 2d8a2b738ee..bb9cb127d07 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1090,8 +1090,6 @@ select column_default from information_schema.columns where table_name= 't1';
show columns from t1;
drop table t1;
---echo End of 5.0 tests.
-
#
# Bug#30079 A check for "hidden" I_S tables is flawed
#
@@ -1099,6 +1097,32 @@ drop table t1;
show fields from information_schema.table_names;
--error 1109
show keys from information_schema.table_names;
+
+#
+# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
+#
+USE information_schema;
+SET max_heap_table_size = 16384;
+
+CREATE TABLE test.t1( a INT );
+
+# What we need to create here is a bit of a corner case:
+# We need a star query with information_schema tables, where the first
+# branch of the star join produces zero rows, so that reading of the
+# second branch never happens. At the same time we have to make sure
+# that data for at least the last table is swapped from MEMORY/HEAP to
+# MyISAM. This and only this triggers the bug.
+SELECT *
+FROM tables ta
+JOIN collations co ON ( co.collation_name = ta.table_catalog )
+JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog );
+
+DROP TABLE test.t1;
+SET max_heap_table_size = DEFAULT;
+USE test;
+
+--echo End of 5.0 tests.
+
#
# Show engines
#
@@ -1270,4 +1294,48 @@ show open tables where f1()=0;
drop table t1;
drop function f1;
+#
+# BUG#34656 - KILL a query = Assertion failed: m_status == DA_ERROR ||
+# m_status == DA_OK
+#
+connect (conn1, localhost, root,,);
+connection conn1;
+let $ID= `select connection_id()`;
+send select * from information_schema.tables where 1=sleep(100000);
+connection default;
+let $wait_timeout= 10;
+let $wait_condition=select count(*)=1 from information_schema.processlist
+where state='User sleep' and
+info='select * from information_schema.tables where 1=sleep(100000)';
+--source include/wait_condition.inc
+disable_query_log;
+eval kill $ID;
+enable_query_log;
+disconnect conn1;
+let $wait_timeout= 10;
+let $wait_condition=select count(*)=0 from information_schema.processlist
+where state='User sleep' and
+info='select * from information_schema.tables where 1=sleep(100000)';
+--source include/wait_condition.inc
+
+connect (conn1, localhost, root,,);
+connection conn1;
+let $ID= `select connection_id()`;
+send select * from information_schema.columns where 1=sleep(100000);
+connection default;
+let $wait_timeout= 10;
+let $wait_condition=select count(*)=1 from information_schema.processlist
+where state='User sleep' and
+info='select * from information_schema.columns where 1=sleep(100000)';
+--source include/wait_condition.inc
+disable_query_log;
+eval kill $ID;
+enable_query_log;
+disconnect conn1;
+let $wait_timeout= 10;
+let $wait_condition=select count(*)=0 from information_schema.processlist
+where state='User sleep' and
+info='select * from information_schema.columns where 1=sleep(100000)';
+--source include/wait_condition.inc
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
index e73f4ba2792..1a537d740b7 100644
--- a/mysql-test/t/information_schema_inno.test
+++ b/mysql-test/t/information_schema_inno.test
@@ -76,3 +76,16 @@ select referenced_table_schema, referenced_table_name
from information_schema.key_column_usage
where constraint_schema = 'db-1';
drop database `db-1`;
+
+#
+# Bug#35108 SELECT FROM REFERENTIAL_CONSTRAINTS crashes
+#
+create table t1(id int primary key) engine = Innodb;
+create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb;
+set foreign_key_checks = 0;
+drop table t1;
+select UNIQUE_CONSTRAINT_NAME
+from information_schema.referential_constraints
+where constraint_schema = schema();
+drop table t2;
+set foreign_key_checks = 1;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 04ddb718f7d..0070a35b164 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -2436,6 +2436,29 @@ select table_comment, data_free > 0 as data_free_is_set
where table_schema='test' and table_name = 't1';
drop table t1;
+#
+# Bug 34920 test
+#
+CONNECTION default;
+CREATE TABLE t1 (
+ c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ c2 VARCHAR(128) NOT NULL,
+ PRIMARY KEY(c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100;
+
+CREATE TABLE t2 (
+ c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ c2 INT(10) UNSIGNED DEFAULT NULL,
+ PRIMARY KEY(c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200;
+
+SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
+ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1);
+SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
+DROP TABLE t2;
+DROP TABLE t1;
+# End 34920 test
+
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index b7e1e82fe5d..8ef668f542b 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -8,6 +8,7 @@
# Disable concurrent inserts to avoid test failures when reading the
# connection id which was inserted into a table by another thread.
+set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
connect (con1, localhost, root,,);
@@ -326,3 +327,9 @@ KILL CONNECTION_ID();
--echo # of close of the connection socket
--error 2013, 2006
SELECT 1;
+--connection default
+
+###########################################################################
+
+# Restore global concurrent_insert value. Keep in the end of the test file.
+set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 3ed6852fb46..72e25846a51 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -240,6 +240,88 @@ SELECT * FROM t1;
remove_file $MYSQLTEST_VARDIR/tmp/t1;
DROP TABLE t1;
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
+--echo # --
+
+--echo
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+DROP VIEW IF EXISTS v2;
+DROP VIEW IF EXISTS v3;
+--enable_warnings
+
+--echo
+CREATE TABLE t1(c1 INT, c2 VARCHAR(255));
+
+--echo
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
+CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
+
+--echo
+LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
+ FIELDS ESCAPED BY '\\'
+ TERMINATED BY ','
+ ENCLOSED BY '"'
+ LINES TERMINATED BY '\n' (c1, c2);
+
+--echo
+SELECT * FROM t1;
+
+--echo
+SELECT * FROM v1;
+
+--echo
+DELETE FROM t1;
+
+--echo
+LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
+ FIELDS ESCAPED BY '\\'
+ TERMINATED BY ','
+ ENCLOSED BY '"'
+ LINES TERMINATED BY '\n' (c1, c2);
+
+--echo
+SELECT * FROM t1;
+
+--echo
+SELECT * FROM v2;
+
+--echo
+DELETE FROM t1;
+
+--echo
+--error ER_LOAD_DATA_INVALID_COLUMN
+LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
+ FIELDS ESCAPED BY '\\'
+ TERMINATED BY ','
+ ENCLOSED BY '"'
+ LINES TERMINATED BY '\n' (c0, c2);
+
+--echo
+--error ER_NON_UPDATABLE_TABLE
+LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
+ FIELDS ESCAPED BY '\\'
+ TERMINATED BY ','
+ ENCLOSED BY '"'
+ LINES TERMINATED BY '\n' (d1, d2);
+
+--echo
+DROP TABLE t1;
+DROP VIEW v1;
+DROP VIEW v2;
+DROP VIEW v3;
+
+--echo
+--echo # -- End of Bug#35469.
+
+###########################################################################
+
# End of 5.0 tests
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 0c986c6d63a..3047d16d3b6 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -131,6 +131,16 @@ SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON;
#
+# Bug#23924 general_log truncates queries with character set introducers.
+#
+truncate table mysql.general_log;
+set names binary;
+select _koi8r'ÔÅÓÔ' as test;
+--replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
+select * from mysql.general_log;
+set names utf8;
+
+#
# Bug #16905 Log tables: unicode statements are logged incorrectly
#
diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test
index eddcbb59ed4..b687973c9d1 100644
--- a/mysql-test/t/merge-big.test
+++ b/mysql-test/t/merge-big.test
@@ -3,8 +3,10 @@
#
# This test takes rather long time so let us run it only in --big-test mode
--source include/big_test.inc
-# We are using some debug-only features in this test
+# We use some debug-only features in this test
--source include/have_debug.inc
+# We use INFORMATION_SCHEMA.PROCESSLIST in this test
+--source include/not_embedded.inc
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
@@ -46,6 +48,8 @@ LOCK TABLE t1 WRITE;
--echo # connection default
connection default;
--echo # Let INSERT go into thr_multi_lock().
+#--sleep 8
+#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID = $con1_id AND STATE = 'Locked';
--source include/wait_condition.inc
@@ -54,8 +58,10 @@ let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
FLUSH TABLES;
#SELECT NOW();
--echo # Let INSERT go through open_tables() where it sleeps.
+#--sleep 8
+#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'DBUG sleep';
+ WHERE ID = $con1_id AND STATE = 'Waiting for table';
--source include/wait_condition.inc
#SELECT NOW();
--echo # Unlock and close table and wait for con1 to close too.
@@ -74,77 +80,3 @@ UNLOCK TABLES;
connection default;
DROP TABLE t1;
---echo #
---echo # Extra tests for Bug#26379 - Combination of FLUSH TABLE and
---echo # REPAIR TABLE corrupts a MERGE table
---echo #
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE t3 (c1 INT);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-INSERT INTO t3 VALUES (3);
---echo #
---echo # CREATE ... SELECT
---echo # try to access parent from another thread.
---echo #
-#SELECT NOW();
- --echo # connection con1
- connect (con1,localhost,root,,);
- let $con1_id= `SELECT CONNECTION_ID()`;
- SET SESSION debug="+d,sleep_create_select_before_lock";
- send CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2)
- INSERT_METHOD=FIRST SELECT * FROM t3;
---echo # connection default
-connection default;
-# wait for the other query to start executing
-let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'DBUG sleep';
---source include/wait_condition.inc
-#SELECT NOW();
---echo # Now try to access the parent.
---echo # If 3 is in table, SELECT had to wait.
-SELECT * FROM t4 ORDER BY c1;
-#SELECT NOW();
- --echo # connection con1
- connection con1;
- reap;
- #SELECT NOW();
- SET SESSION debug="-d,sleep_create_select_before_lock";
- disconnect con1;
---echo # connection default
-connection default;
---echo # Cleanup for next test.
-DROP TABLE t4;
-DELETE FROM t1 WHERE c1 != 1;
---echo #
---echo # CREATE ... SELECT
---echo # try to access child from another thread.
---echo #
-#SELECT NOW();
- --echo # connection con1
- connect (con1,localhost,root,,);
- let $con1_id= `SELECT CONNECTION_ID()`;
- SET SESSION debug="+d,sleep_create_select_before_lock";
- send CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2)
- INSERT_METHOD=FIRST SELECT * FROM t3;
---echo # connection default
-connection default;
-# wait for the other query to start executing
-let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'DBUG sleep';
---source include/wait_condition.inc
-#SELECT NOW();
---echo # Now try to access a child.
---echo # If 3 is in table, SELECT had to wait.
-SELECT * FROM t1 ORDER BY c1;
-#SELECT NOW();
- --echo # connection con1
- connection con1;
- reap;
- #SELECT NOW();
- SET SESSION debug="-d,sleep_create_select_before_lock";
- disconnect con1;
---echo # connection default
-connection default;
-DROP TABLE t1, t2, t3, t4;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index e49297dd06c..a4602a3b82a 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -599,6 +599,19 @@ SELECT * FROM t3;
DROP TABLE t1, t2, t3;
+#
+# BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed
+#
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) ENGINE=MERGE;
+SHOW CREATE TABLE m1;
+DROP TABLE m1;
+CREATE TABLE m1(a INT) ENGINE=MERGE UNION=();
+SHOW CREATE TABLE m1;
+ALTER TABLE m1 UNION=(t1);
+ALTER TABLE m1 UNION=();
+SHOW CREATE TABLE m1;
+DROP TABLE t1, m1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index fbd0a5ac4e7..21ffa0683b6 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1278,5 +1278,189 @@ DELETE FROM t1 WHERE c1 >= 10;
CHECK TABLE t1;
DROP TABLE t1;
+#
+# Bug#33222 - myisam-table drops rows when column is added
+# and a char-field > 128 exists
+#
+# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+CREATE TABLE t1 (
+ c1 CHAR(130),
+ c2 VARCHAR(1)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+REPAIR TABLE t1;
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+#
+# Test #2 - same as test #1, but using EXTENDED.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+CREATE TABLE t1 (
+ c1 CHAR(130),
+ c2 VARCHAR(1)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1 EXTENDED;
+REPAIR TABLE t1 EXTENDED;
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+#
+# Test #3 - same as test #1, but using OPTIMIZE TABLE.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+CREATE TABLE t1 (
+ c1 CHAR(130),
+ c2 VARCHAR(1)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
+# Insert more rows and delete one in the middle to force optimize.
+INSERT INTO t1 VALUES('b', 'b');
+INSERT INTO t1 VALUES('c', 'b');
+DELETE FROM t1 WHERE c1='b';
+SELECT COUNT(*) FROM t1;
+OPTIMIZE TABLE t1;
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+#
+# Test #4 - ALTER TABLE deletes rows.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+# Using an index which can be disabled during bulk insert.
+CREATE TABLE t1 (
+ c1 CHAR(130),
+ c2 VARCHAR(1),
+ KEY (c1)
+) ENGINE=MyISAM;
+#
+# Insert 100 rows. This turns bulk insert on during the copy phase of
+# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
+# them by repair after the insert.
+--disable_query_log
+let $count= 100;
+--echo # Insert $count rows. Query log disabled.
+while ($count)
+{
+ INSERT INTO t1 VALUES ('a', 'b');
+ dec $count;
+}
+--enable_query_log
+#
+# Change most of the rows into long character values with > 127 characters.
+UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90;
+SELECT COUNT(*) FROM t1;
+ALTER TABLE t1 ENGINE=MyISAM;
+#
+# With bug present, this shows that all long rows are gone.
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+#
+# Test #5 - same as test #1 but UTF-8.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+CREATE TABLE t1 (
+ c1 CHAR(50),
+ c2 VARCHAR(1)
+) ENGINE=MyISAM DEFAULT CHARSET UTF8;
+# Using Tamil Letter A, Unicode U+0B85
+INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+REPAIR TABLE t1;
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+#
+# Test #6 - same as test #2, but UTF-8.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+CREATE TABLE t1 (
+ c1 CHAR(50),
+ c2 VARCHAR(1)
+) ENGINE=MyISAM DEFAULT CHARSET UTF8;
+# Using Tamil Letter A, Unicode U+0B85
+INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1 EXTENDED;
+REPAIR TABLE t1 EXTENDED;
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+#
+# Test #7 - same as test #3, but UTF-8.
+# Using a CHAR column that can have > 127 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+CREATE TABLE t1 (
+ c1 CHAR(50),
+ c2 VARCHAR(1)
+) ENGINE=MyISAM DEFAULT CHARSET UTF8;
+# Using Tamil Letter A, Unicode U+0B85
+INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
+# Insert more rows and delete one in the middle to force optimize.
+INSERT INTO t1 VALUES('b', 'b');
+INSERT INTO t1 VALUES('c', 'b');
+DELETE FROM t1 WHERE c1='b';
+SELECT COUNT(*) FROM t1;
+OPTIMIZE TABLE t1;
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+#
+# Test #8 - same as test #4, but UTF-8.
+# Using a CHAR column that can have > 42 UTF-8 characters.
+# Using a VARCHAR to create a table with dynamic row format.
+# Using an index which can be disabled during bulk insert.
+CREATE TABLE t1 (
+ c1 CHAR(50),
+ c2 VARCHAR(1),
+ KEY (c1)
+) ENGINE=MyISAM DEFAULT CHARSET UTF8;
+#
+# Insert 100 rows. This turns bulk insert on during the copy phase of
+# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
+# them by repair after the insert.
+--disable_query_log
+let $count= 100;
+--echo # Insert $count rows. Query log disabled.
+while ($count)
+{
+ INSERT INTO t1 VALUES ('a', 'b');
+ dec $count;
+}
+--enable_query_log
+#
+# Change most of the rows into long character values with > 42 characters.
+# Using Tamil Letter A, Unicode U+0B85
+UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
+SELECT COUNT(*) FROM t1;
+ALTER TABLE t1 ENGINE=MyISAM;
+#
+# With bug present, this shows that all long rows are gone.
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+
+#
+# Bug#29182 - MyISAMCHK reports wrong character set
+#
+CREATE TABLE t1 (
+ c1 VARCHAR(10) NOT NULL,
+ c2 CHAR(10) DEFAULT NULL,
+ c3 VARCHAR(10) NOT NULL,
+ KEY (c1),
+ KEY (c2)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/mysqldump-no-binlog-master.opt b/mysql-test/t/mysqldump-no-binlog-master.opt
new file mode 100644
index 00000000000..789275fa25e
--- /dev/null
+++ b/mysql-test/t/mysqldump-no-binlog-master.opt
@@ -0,0 +1 @@
+--skip-log-bin
diff --git a/mysql-test/t/mysqldump-no-binlog.test b/mysql-test/t/mysqldump-no-binlog.test
new file mode 100644
index 00000000000..434b2931792
--- /dev/null
+++ b/mysql-test/t/mysqldump-no-binlog.test
@@ -0,0 +1,6 @@
+# Embedded server doesn't support external clients
+--source include/not_embedded.inc
+
+--replace_regex /MASTER_LOG_POS=[0-9]+/XX/
+--error 2
+--exec $MYSQL_DUMP --compact --master-data=2 test 2>&1
diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test
index e15aec01d2a..1400c643203 100644
--- a/mysql-test/t/null_key.test
+++ b/mysql-test/t/null_key.test
@@ -240,3 +240,26 @@ SHOW STATUS LIKE "handler_read%";
DROP TABLE t1,t2,t3,t4;
# End of 4.1 tests
+
+#
+# BUG#34945 "ref_or_null queries that are null_rejecting and have a null value crash mysql"
+#
+CREATE TABLE t1 (
+ a int(11) default NULL,
+ b int(11) default NULL,
+ KEY a (a,b)
+);
+INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
+
+CREATE TABLE t2 (
+ a int(11) default NULL,
+ b int(11) default NULL,
+ KEY a (a)
+);
+INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);
+
+SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b;
+
+drop table t1, t2;
+-- echo End of 5.0 tests
+
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 71238504d36..64665c6b5bd 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -836,3 +836,476 @@ eval set @tmp_tables_after =
SELECT @tmp_tables_after = @tmp_tables_before;
DROP TABLE t1;
+--echo #
+--echo # Bug#31590: Wrong error message on sort buffer being too small.
+--echo #
+create table t1(a int, b tinytext);
+insert into t1 values (1,2),(3,2);
+set session sort_buffer_size= 30000;
+set session max_sort_length= 2180;
+--error 1038
+select * from t1 order by b;
+drop table t1;
+
+#
+# Bug #35206: select query result different if the key is indexed or not
+#
+
+CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
+ UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
+
+CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
+CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b));
+
+--disable_query_log
+INSERT INTO t1 (a, b) VALUES
+('domestic', 'CH'), ('domestic', 'LI'), ('plfcz1', 'FR'), ('all', 'AD'),
+('all', 'AE'), ('all', 'AF'), ('all', 'AG'), ('all', 'AI'), ('all', 'AL'),
+('all', 'AM'), ('all', 'AN'), ('all', 'AO'), ('all', 'AP'), ('all', 'AQ'),
+('all', 'AR'), ('all', 'AS'), ('all', 'AT'), ('all', 'AU'), ('all', 'AW'),
+('all', 'AZ'), ('all', 'BA'), ('all', 'BB'), ('all', 'BD'), ('all', 'BE'),
+('all', 'BF'), ('all', 'BG'), ('all', 'BH'), ('all', 'BI'), ('all', 'BJ'),
+('all', 'BM'), ('all', 'BN'), ('all', 'BO'), ('all', 'BR'), ('all', 'BS'),
+('all', 'BT'), ('all', 'BV'), ('all', 'BW'), ('all', 'BY'), ('all', 'BZ'),
+('all', 'CA'), ('all', 'CC'), ('all', 'CD'), ('all', 'CF'), ('all', 'CG'),
+('all', 'CH'), ('all', 'CI'), ('all', 'CK'), ('all', 'CL'), ('all', 'CM'),
+('all', 'CN'), ('all', 'CO'), ('all', 'CR'), ('all', 'CU'), ('all', 'CV'),
+('all', 'CX'), ('all', 'CY'), ('all', 'CZ'), ('all', 'DE'), ('all', 'DJ'),
+('all', 'DK'), ('all', 'DM'), ('all', 'DO'), ('all', 'DZ'), ('all', 'EC'),
+('all', 'EE'), ('all', 'EG'), ('all', 'EH'), ('all', 'EI'), ('all', 'ER'),
+('all', 'ES'), ('all', 'ET'), ('all', 'FI'), ('all', 'FJ'), ('all', 'FK'),
+('all', 'FM'), ('all', 'FO'), ('all', 'FR'), ('all', 'FX'), ('all', 'GA'),
+('all', 'GB'), ('all', 'GD'), ('all', 'GE'), ('all', 'GF'), ('all', 'GH'),
+('all', 'GI'), ('all', 'GL'), ('all', 'GM'), ('all', 'GN'), ('all', 'GP'),
+('all', 'GQ'), ('all', 'GR'), ('all', 'GS'), ('all', 'GT'), ('all', 'GU'),
+('all', 'GW'), ('all', 'GY'), ('all', 'HK'), ('all', 'HM'), ('all', 'HN'),
+( 'all', 'HR'), ( 'all', 'HT'), ( 'all', 'HU'), ( 'all', 'ID'), ( 'all', 'IE'),
+( 'all', 'IL'), ( 'all', 'IN'), ( 'all', 'IO'), ( 'all', 'IQ'), ( 'all', 'IR'),
+( 'all', 'IS'), ( 'all', 'IT'), ( 'all', 'JM'), ( 'all', 'JO'), ( 'all', 'JP'),
+( 'all', 'KE'), ( 'all', 'KG'), ( 'all', 'KH'), ( 'all', 'KI'), ( 'all', 'KM'),
+( 'all', 'KN'), ( 'all', 'KP'), ( 'all', 'KR'), ( 'all', 'KW'), ( 'all', 'KY'),
+( 'all', 'KZ'), ( 'all', 'LA'), ( 'all', 'LB'), ( 'all', 'LC'), ( 'all', 'LI'),
+( 'all', 'LK'), ( 'all', 'LR'), ( 'all', 'LS'), ( 'all', 'LT'), ( 'all', 'LU'),
+( 'all', 'LV'), ( 'all', 'LY'), ( 'all', 'MA'), ( 'all', 'MC'), ( 'all', 'MD'),
+( 'all', 'ME'), ( 'all', 'MG'), ( 'all', 'MH'), ( 'all', 'MK'), ( 'all', 'ML'),
+( 'all', 'MM'), ( 'all', 'MN'), ( 'all', 'MO'), ( 'all', 'MP'), ( 'all', 'MQ'),
+( 'all', 'MR'), ( 'all', 'MS'), ( 'all', 'MT'), ( 'all', 'MU'), ( 'all', 'MV'),
+( 'all', 'MW'), ( 'all', 'MX'), ( 'all', 'MY'), ( 'all', 'MZ'), ( 'all', 'NA'),
+( 'all', 'NC'), ( 'all', 'NE'), ( 'all', 'NF'), ( 'all', 'NG'), ( 'all', 'NI'),
+( 'all', 'NL'), ( 'all', 'NO'), ( 'all', 'NP'), ( 'all', 'NR'), ( 'all', 'NU'),
+( 'all', 'NV'), ( 'all', 'NZ'), ( 'all', 'OM'), ( 'all', 'PA'), ( 'all', 'PE'),
+( 'all', 'PF'), ( 'all', 'PG'), ( 'all', 'PH'), ( 'all', 'PK'), ( 'all', 'PL'),
+( 'all', 'PM'), ( 'all', 'PN'), ( 'all', 'PR'), ( 'all', 'PS'), ( 'all', 'PT'),
+( 'all', 'PW'), ( 'all', 'PY'), ( 'all', 'QA'), ( 'all', 'RE'), ( 'all', 'RO'),
+( 'all', 'RU'), ( 'all', 'RW'), ( 'all', 'SA'), ( 'all', 'SB'), ( 'all', 'SC'),
+( 'all', 'SD'), ( 'all', 'SE'), ( 'all', 'SG'), ( 'all', 'SH'), ( 'all', 'SI'),
+( 'all', 'SJ'), ( 'all', 'SK'), ( 'all', 'SL'), ( 'all', 'SM'), ( 'all', 'SN'),
+( 'all', 'SO'), ( 'all', 'SR'), ( 'all', 'ST'), ( 'all', 'SV'), ( 'all', 'SY'),
+( 'all', 'SZ'), ( 'all', 'TA'), ( 'all', 'TC'), ( 'all', 'TD'), ( 'all', 'TF'),
+( 'all', 'TG'), ( 'all', 'TH'), ( 'all', 'TJ'), ( 'all', 'TK'), ( 'all', 'TM'),
+( 'all', 'TN'), ( 'all', 'TO'), ( 'all', 'TP'), ( 'all', 'TR'), ( 'all', 'TT'),
+( 'all', 'TV'), ( 'all', 'TW'), ( 'all', 'TZ'), ( 'all', 'UA'), ( 'all', 'UG'),
+( 'all', 'UM'), ( 'all', 'US'), ( 'all', 'UY'), ( 'all', 'UZ'), ( 'all', 'VA'),
+( 'all', 'VC'), ( 'all', 'VE'), ( 'all', 'VG'), ( 'all', 'VI'), ( 'all', 'VN'),
+( 'all', 'VU'), ( 'all', 'WF'), ( 'all', 'WS'), ( 'plfcz1', 'FI'),
+( 'all', 'XE'), ( 'all', 'XS'), ( 'all', 'XU'), ( 'plfcz1', 'XE'),
+( 'all', 'YE'), ( 'all', 'YT'), ( 'all', 'YU'), ( 'all', 'ZA'), ( 'all', 'ZM'),
+( 'all', 'ZR'), ( 'all', 'ZW'), ( 'foreign', 'AD'), ( 'foreign', 'AE'),
+( 'foreign', 'AF'), ( 'foreign', 'AG'), ( 'foreign', 'AI'),
+( 'foreign', 'AL'), ( 'foreign', 'AM'), ( 'foreign', 'AN'), ( 'foreign', 'AO'),
+( 'foreign', 'AP'), ( 'foreign', 'AQ'), ( 'foreign', 'AR'), ( 'foreign', 'AS'),
+( 'foreign', 'AT'), ( 'foreign', 'AU'), ( 'foreign', 'AW'), ( 'foreign', 'AZ'),
+( 'foreign', 'BA'), ( 'foreign', 'BB'), ( 'foreign', 'BD'), ( 'foreign', 'BE'),
+( 'foreign', 'BF'), ( 'foreign', 'BG'), ( 'foreign', 'BH'), ( 'foreign', 'BI'),
+( 'foreign', 'BJ'), ( 'foreign', 'BM'), ( 'foreign', 'BN'), ( 'foreign', 'BO'),
+( 'foreign', 'BR'), ( 'foreign', 'BS'), ( 'foreign', 'BT'), ( 'foreign', 'BV'),
+( 'foreign', 'BW'), ( 'foreign', 'BY'), ( 'foreign', 'BZ'), ( 'foreign', 'CA'),
+( 'foreign', 'CC'), ( 'foreign', 'CD'), ( 'foreign', 'CF'), ( 'foreign', 'CG'),
+( 'foreign', 'CI'), ( 'foreign', 'CK'), ( 'foreign', 'CL'), ( 'foreign', 'CM'),
+( 'foreign', 'CN'), ( 'foreign', 'CO'), ( 'foreign', 'CR'), ( 'foreign', 'CU'),
+( 'foreign', 'CV'), ( 'foreign', 'CX'), ( 'foreign', 'CY'), ( 'foreign', 'CZ'),
+( 'foreign', 'DE'), ( 'foreign', 'DJ'), ( 'foreign', 'DK'), ( 'foreign', 'DM'),
+( 'foreign', 'DO'), ( 'foreign', 'DZ'), ( 'foreign', 'EC'), ( 'foreign', 'EE'),
+( 'foreign', 'EG'), ( 'foreign', 'EH'), ( 'foreign', 'EI'), ( 'foreign', 'ER'),
+( 'foreign', 'ES'), ( 'foreign', 'ET'), ( 'foreign', 'FI'), ( 'foreign', 'FJ'),
+( 'foreign', 'FK'), ( 'foreign', 'FM'), ( 'foreign', 'FO'), ( 'foreign', 'FR'),
+( 'foreign', 'FX'), ( 'foreign', 'GA'), ( 'foreign', 'GB'), ( 'foreign', 'GD'),
+( 'foreign', 'GE'), ( 'foreign', 'GF'), ( 'foreign', 'GH'), ( 'foreign', 'GI'),
+( 'foreign', 'GL'), ( 'foreign', 'GM'), ( 'foreign', 'GN'), ( 'foreign', 'GP'),
+( 'foreign', 'GQ'), ( 'foreign', 'GR'), ( 'foreign', 'GS'), ( 'foreign', 'GT'),
+( 'foreign', 'GU'), ( 'foreign', 'GW'), ( 'foreign', 'GY'), ( 'foreign', 'HK'),
+( 'foreign', 'HM'), ( 'foreign', 'HN'), ( 'foreign', 'HR'), ( 'foreign', 'HT'),
+( 'foreign', 'HU'), ( 'foreign', 'ID'), ( 'foreign', 'IE'), ( 'foreign', 'IL'),
+( 'foreign', 'IN'), ( 'foreign', 'IO'), ( 'foreign', 'IQ'), ( 'foreign', 'IR'),
+( 'foreign', 'IS'), ( 'foreign', 'IT'), ( 'foreign', 'JM'), ( 'foreign', 'JO'),
+( 'foreign', 'JP'), ( 'foreign', 'KE'), ( 'foreign', 'KG'), ( 'foreign', 'KH'),
+( 'foreign', 'KI'), ( 'foreign', 'KM'), ( 'foreign', 'KN'), ( 'foreign', 'KP'),
+( 'foreign', 'KR'), ( 'foreign', 'KW'), ( 'foreign', 'KY'), ( 'foreign', 'KZ'),
+( 'foreign', 'LA'), ( 'foreign', 'LB'), ( 'foreign', 'LC'), ( 'foreign', 'LK'),
+( 'foreign', 'LR'), ( 'foreign', 'LS'), ( 'foreign', 'LT'), ( 'foreign', 'LU'),
+( 'foreign', 'LV'), ( 'foreign', 'LY'), ( 'foreign', 'MA'), ( 'foreign', 'MC'),
+( 'foreign', 'MD'), ( 'foreign', 'ME'), ( 'foreign', 'MG'), ( 'foreign', 'MH'),
+( 'foreign', 'MK'), ( 'foreign', 'ML'), ( 'foreign', 'MM'), ( 'foreign', 'MN'),
+( 'foreign', 'MO'), ( 'foreign', 'MP'), ( 'foreign', 'MQ'), ( 'foreign', 'MR'),
+( 'foreign', 'MS'), ( 'foreign', 'MT'), ( 'foreign', 'MU'), ( 'foreign', 'MV'),
+( 'foreign', 'MW'), ( 'foreign', 'MX'), ( 'foreign', 'MY'), ( 'foreign', 'MZ'),
+( 'foreign', 'NA'), ( 'foreign', 'NC'), ( 'foreign', 'NE'), ( 'foreign', 'NF'),
+( 'foreign', 'NG'), ( 'foreign', 'NI'), ( 'foreign', 'NL'), ( 'foreign', 'NO'),
+( 'foreign', 'NP'), ( 'foreign', 'NR'), ( 'foreign', 'NU'), ( 'foreign', 'NV'),
+( 'foreign', 'NZ'), ( 'foreign', 'OM'), ( 'foreign', 'PA'), ( 'foreign', 'PE'),
+( 'foreign', 'PF'), ( 'foreign', 'PG'), ( 'foreign', 'PH'), ( 'foreign', 'PK'),
+( 'foreign', 'PL'), ( 'foreign', 'PM'), ( 'foreign', 'PN'), ( 'foreign', 'PR'),
+( 'foreign', 'PS'), ( 'foreign', 'PT'), ( 'foreign', 'PW'), ( 'foreign', 'PY'),
+( 'foreign', 'QA'), ( 'foreign', 'RE'), ( 'foreign', 'RO'), ( 'foreign', 'RU'),
+( 'foreign', 'RW'), ( 'foreign', 'SA'), ( 'foreign', 'SB'), ( 'foreign', 'SC'),
+( 'foreign', 'SD'), ( 'foreign', 'SE'), ( 'foreign', 'SG'), ( 'foreign', 'SH'),
+( 'foreign', 'SI'), ( 'foreign', 'SJ'), ( 'foreign', 'SK'), ( 'foreign', 'SL'),
+( 'foreign', 'SM'), ( 'foreign', 'SN'), ( 'foreign', 'SO'), ( 'foreign', 'SR'),
+( 'foreign', 'ST'), ( 'foreign', 'SV'), ( 'foreign', 'SY'), ( 'foreign', 'SZ'),
+( 'foreign', 'TA'), ( 'foreign', 'TC'), ( 'foreign', 'TD'), ( 'foreign', 'TF'),
+( 'foreign', 'TG'), ( 'foreign', 'TH'), ( 'foreign', 'TJ'), ( 'foreign', 'TK'),
+( 'foreign', 'TM'), ( 'foreign', 'TN'), ( 'foreign', 'TO'), ( 'foreign', 'TP'),
+( 'foreign', 'TR'), ( 'foreign', 'TT'), ( 'foreign', 'TV'), ( 'foreign', 'TW'),
+( 'foreign', 'TZ'), ( 'foreign', 'UA'), ( 'foreign', 'UG'), ( 'foreign', 'UM'),
+( 'foreign', 'US'), ( 'foreign', 'UY'), ( 'foreign', 'UZ'), ( 'foreign', 'VA'),
+( 'foreign', 'VC'), ( 'foreign', 'VE'), ( 'foreign', 'VG'), ( 'foreign', 'VI'),
+( 'foreign', 'VN'), ( 'foreign', 'VU'), ( 'foreign', 'WF'), ( 'foreign', 'WS'),
+( 'plfcz1', 'DK'), ( 'foreign', 'XE'), ( 'foreign', 'XS'), ( 'foreign', 'XU'),
+( 'plfcz1', 'BE'), ( 'foreign', 'YE'), ( 'foreign', 'YT'), ( 'foreign', 'YU'),
+( 'foreign', 'ZA'), ( 'foreign', 'ZM'), ( 'foreign', 'ZR'), ( 'foreign', 'ZW'),
+( 'plfcz1', 'DE'), ( 'plfcz1', 'GI'), ( 'plfcz1', 'GR'), ( 'plfcz1', 'IS'),
+( 'plfcz1', 'EI'), ( 'plfcz1', 'IT'), ( 'plfcz1', 'LU'), ( 'plfcz1', 'NL'),
+( 'plfcz1', 'NO'), ( 'plfcz1', 'ES'), ( 'plfcz1', 'SE'), ( 'plfcz1', 'AL'),
+( 'plfcz1', 'AD'), ( 'plfcz1', 'BY'), ( 'plfcz1', 'BA'), ( 'plfcz1', 'BG'),
+( 'plfcz1', 'EE'), ( 'plfcz1', 'FO'), ( 'plfcz1', 'GL'), ( 'plfcz1', 'GB'),
+( 'plfcz1', 'HR'), ( 'plfcz1', 'LV'), ( 'plfcz1', 'LT'), ( 'plfcz1', 'MT'),
+( 'plfcz1', 'MK'), ( 'plfcz1', 'MD'), ( 'plfcz1', 'MC'), ( 'plfcz1', 'AT'),
+( 'plfcz1', 'PL'), ( 'plfcz1', 'PT'), ( 'plfcz1', 'RO'), ( 'plfcz1', 'RU'),
+( 'plfcz1', 'SM'), ( 'plfcz1', 'XS'), ( 'plfcz1', 'SK'), ( 'plfcz1', 'SI'),
+( 'plfcz1', 'CZ'), ( 'plfcz1', 'TR'), ( 'plfcz1', 'UA'), ( 'plfcz1', 'HU'),
+( 'plfcz1', 'VA'), ( 'plfcz1', 'CY'), ( 'plfcz2', 'AF'), ( 'plfcz2', 'DZ'),
+( 'plfcz2', 'AS'), ( 'plfcz2', 'AO'), ( 'plfcz2', 'AI'), ( 'plfcz2', 'AQ'),
+( 'plfcz2', 'AG'), ( 'plfcz2', 'AR'), ( 'plfcz2', 'AM'), ( 'plfcz2', 'AW'),
+( 'plfcz2', 'AU'), ( 'plfcz2', 'AZ'), ( 'plfcz2', 'AP'), ( 'plfcz2', 'BS'),
+( 'plfcz2', 'BH'), ( 'plfcz2', 'BD'), ( 'plfcz2', 'BB'), ( 'plfcz2', 'BZ'),
+( 'plfcz2', 'BJ'), ( 'plfcz2', 'BM'), ( 'plfcz2', 'BT'), ( 'plfcz2', 'BO'),
+( 'plfcz2', 'BW'), ( 'plfcz2', 'BV'), ( 'plfcz2', 'BR'), ( 'plfcz2', 'IO'),
+( 'plfcz2', 'VG'), ( 'plfcz2', 'BN'), ( 'plfcz2', 'BF'), ( 'plfcz2', 'BI'),
+( 'plfcz2', 'KH'), ( 'plfcz2', 'CM'), ( 'plfcz2', 'CA'), ( 'plfcz2', 'CV'),
+( 'plfcz2', 'KY'), ( 'plfcz2', 'CF'), ( 'plfcz2', 'TD'), ( 'plfcz2', 'CL'),
+( 'plfcz2', 'CN'), ( 'plfcz2', 'CX'), ( 'plfcz2', 'CC'), ( 'plfcz2', 'CO'),
+( 'plfcz2', 'KM'), ( 'plfcz2', 'CG'), ( 'plfcz2', 'CD'), ( 'plfcz2', 'CK'),
+( 'plfcz2', 'CR'), ( 'plfcz2', 'CI'), ( 'plfcz2', 'CU'), ( 'plfcz2', 'DJ'),
+( 'plfcz2', 'DM'), ( 'plfcz2', 'DO'), ( 'plfcz2', 'TP'), ( 'plfcz2', 'EC'),
+( 'plfcz2', 'EG'), ( 'plfcz2', 'SV'), ( 'plfcz2', 'GQ'), ( 'plfcz2', 'ER'),
+( 'plfcz2', 'ET'), ( 'plfcz2', 'FK'), ( 'plfcz2', 'FJ'), ( 'plfcz2', 'FX'),
+( 'plfcz2', 'GF'), ( 'plfcz2', 'PF'), ( 'plfcz2', 'TA'), ( 'plfcz2', 'TF'),
+( 'plfcz2', 'GA'), ( 'plfcz2', 'GM'), ( 'plfcz2', 'GE'), ( 'plfcz2', 'GH'),
+( 'plfcz2', 'GD'), ( 'plfcz2', 'GP'), ( 'plfcz2', 'GU'), ( 'plfcz2', 'GT'),
+( 'plfcz2', 'GN'), ( 'plfcz2', 'GW'), ( 'plfcz2', 'GY'), ( 'plfcz2', 'HT'),
+( 'plfcz2', 'HM'), ( 'plfcz2', 'HN'), ( 'plfcz2', 'HK'), ( 'plfcz2', 'IN'),
+( 'plfcz2', 'ID'), ( 'plfcz2', 'IR'), ( 'plfcz2', 'IQ'), ( 'plfcz2', 'IE'),
+( 'plfcz2', 'IL'), ( 'plfcz2', 'JM'), ( 'plfcz2', 'JP'), ( 'plfcz2', 'JO'),
+( 'plfcz2', 'KZ'), ( 'plfcz2', 'KE'), ( 'plfcz2', 'KI'), ( 'plfcz2', 'KP'),
+( 'plfcz2', 'KW'), ( 'plfcz2', 'KG'), ( 'plfcz2', 'LA'), ( 'plfcz2', 'LB'),
+( 'plfcz2', 'LS'), ( 'plfcz2', 'LR'), ( 'plfcz2', 'LY'), ( 'plfcz2', 'MO'),
+( 'plfcz2', 'MG'), ( 'plfcz2', 'ME'), ( 'plfcz2', 'MW'), ( 'plfcz2', 'MY'),
+( 'plfcz2', 'MV'), ( 'plfcz2', 'ML'), ( 'plfcz2', 'MH'), ( 'plfcz2', 'MQ'),
+( 'plfcz2', 'MR'), ( 'plfcz2', 'MU'), ( 'plfcz2', 'YT'), ( 'plfcz2', 'MX'),
+( 'plfcz2', 'FM'), ( 'plfcz2', 'MN'), ( 'plfcz2', 'MS'), ( 'plfcz2', 'MA'),
+( 'plfcz2', 'MZ'), ( 'plfcz2', 'MM'), ( 'plfcz2', 'NA'), ( 'plfcz2', 'NR'),
+( 'plfcz2', 'NP'), ( 'plfcz2', 'AN'), ( 'plfcz2', 'NC'), ( 'plfcz2', 'NZ'),
+( 'plfcz2', 'NI'), ( 'plfcz2', 'NE'), ( 'plfcz2', 'NG'), ( 'plfcz2', 'NU'),
+( 'plfcz2', 'NF'), ( 'plfcz2', 'MP'), ( 'plfcz2', 'OM'), ( 'plfcz2', 'PK'),
+( 'plfcz2', 'PW'), ( 'plfcz2', 'PS'), ( 'plfcz2', 'PA'), ( 'plfcz2', 'PG'),
+( 'plfcz2', 'PY'), ( 'plfcz2', 'PE'), ( 'plfcz2', 'PH'), ( 'plfcz2', 'PN'),
+( 'plfcz2', 'PR'), ( 'plfcz2', 'QA'), ( 'plfcz2', 'RE'), ( 'plfcz2', 'RW'),
+( 'plfcz2', 'KN'), ( 'plfcz2', 'ST'), ( 'plfcz2', 'SA'), ( 'plfcz2', 'SN'),
+( 'plfcz2', 'SC'), ( 'plfcz2', 'SL'), ( 'plfcz2', 'SG'), ( 'plfcz2', 'SB'),
+( 'plfcz2', 'SO'), ( 'plfcz2', 'ZA'), ( 'plfcz2', 'GS'), ( 'plfcz2', 'KR'),
+( 'plfcz2', 'LK'), ( 'plfcz2', 'NV'), ( 'plfcz2', 'SH'), ( 'plfcz2', 'LC'),
+( 'plfcz2', 'PM'), ( 'plfcz2', 'VC'), ( 'plfcz2', 'SD'), ( 'plfcz2', 'SR'),
+( 'plfcz2', 'SJ'), ( 'plfcz2', 'SZ'), ( 'plfcz2', 'SY'), ( 'plfcz2', 'TW'),
+( 'plfcz2', 'TJ'), ( 'plfcz2', 'TZ'), ( 'plfcz2', 'TH'), ( 'plfcz2', 'TG'),
+( 'plfcz2', 'TK'), ( 'plfcz2', 'TO'), ( 'plfcz2', 'TT'), ( 'plfcz2', 'XU'),
+( 'plfcz2', 'TN'), ( 'plfcz2', 'TM'), ( 'plfcz2', 'TC'), ( 'plfcz2', 'TV'),
+( 'plfcz2', 'UG'), ( 'plfcz2', 'AE'), ( 'plfcz2', 'US'), ( 'plfcz2', 'UM'),
+( 'plfcz2', 'UY'), ( 'plfcz2', 'UZ'), ( 'plfcz2', 'VU'), ( 'plfcz2', 'VE'),
+( 'plfcz2', 'VN'), ( 'plfcz2', 'VI'), ( 'plfcz2', 'WF'), ( 'plfcz2', 'EH'),
+( 'plfcz2', 'WS'), ( 'plfcz2', 'YE'), ( 'plfcz2', 'YU'), ( 'plfcz2', 'ZR'),
+( 'plfcz2', 'ZM'), ( 'plfcz2', 'ZW'), ( 'ppfcz1', 'AT'), ( 'ppfcz1', 'BE'),
+( 'ppfcz1', 'DE'), ( 'ppfcz1', 'FR'), ( 'ppfcz1', 'FX'), ( 'ppfcz1', 'IT'),
+( 'ppfcz1', 'LU'), ( 'ppfcz1', 'MC'), ( 'ppfcz1', 'NL'), ( 'ppfcz1', 'SM'),
+( 'ppfcz1', 'VA'), ( 'ppfcz1', 'XE'), ( 'ppfcz2', 'AD'), ( 'ppfcz2', 'AL'),
+( 'ppfcz2', 'BA'), ( 'ppfcz2', 'BG'), ( 'ppfcz2', 'BY'), ( 'ppfcz2', 'CY'),
+( 'ppfcz2', 'CZ'), ( 'ppfcz2', 'DK'), ( 'ppfcz2', 'EE'), ( 'ppfcz2', 'EI'),
+( 'ppfcz2', 'ES'), ( 'ppfcz2', 'FI'), ( 'ppfcz2', 'FO'), ( 'ppfcz2', 'GB'),
+( 'ppfcz2', 'GI'), ( 'ppfcz2', 'GL'), ( 'ppfcz2', 'GR'), ( 'ppfcz2', 'HR'),
+( 'ppfcz2', 'HU'), ( 'ppfcz2', 'IE'), ( 'ppfcz2', 'IS'), ( 'ppfcz2', 'LT'),
+( 'ppfcz2', 'LV'), ( 'ppfcz2', 'MD'), ( 'ppfcz2', 'MK'), ( 'ppfcz2', 'MT'),
+( 'ppfcz2', 'NO'), ( 'ppfcz2', 'PL'), ( 'ppfcz2', 'PT'), ( 'ppfcz2', 'RO'),
+( 'ppfcz2', 'RU'), ( 'ppfcz2', 'SE'), ( 'ppfcz2', 'SI'), ( 'ppfcz2', 'SK'),
+( 'ppfcz2', 'TR'), ( 'ppfcz2', 'UA'), ( 'ppfcz2', 'XS'), ( 'ppfcz2', 'YU'),
+( 'ppfcz3', 'CA'), ( 'ppfcz3', 'DZ'), ( 'ppfcz3', 'EG'), ( 'ppfcz3', 'IL'),
+( 'ppfcz3', 'JO'), ( 'ppfcz3', 'LB'), ( 'ppfcz3', 'LY'), ( 'ppfcz3', 'MA'),
+( 'ppfcz3', 'MX'), ( 'ppfcz3', 'PM'), ( 'ppfcz3', 'SY'), ( 'ppfcz3', 'TN'),
+( 'ppfcz3', 'US'), ( 'ppfcz4', 'AE'), ( 'ppfcz4', 'AF'), ( 'ppfcz4', 'AM'),
+( 'ppfcz4', 'AO'), ( 'ppfcz4', 'AZ'), ( 'ppfcz4', 'BD'), ( 'ppfcz4', 'BF'),
+( 'ppfcz4', 'BH'), ( 'ppfcz4', 'BI'), ( 'ppfcz4', 'BJ'), ( 'ppfcz4', 'BT'),
+( 'ppfcz4', 'BV'), ( 'ppfcz4', 'BW'), ( 'ppfcz4', 'CF'), ( 'ppfcz4', 'CG'),
+( 'ppfcz4', 'CI'), ( 'ppfcz4', 'CM'), ( 'ppfcz4', 'CN'), ( 'ppfcz4', 'DJ'),
+( 'ppfcz4', 'DO'), ( 'ppfcz4', 'ER'), ( 'ppfcz4', 'ET'), ( 'ppfcz4', 'GA'),
+( 'ppfcz4', 'GE'), ( 'ppfcz4', 'GH'), ( 'ppfcz4', 'GM'), ( 'ppfcz4', 'GN'),
+( 'ppfcz4', 'GQ'), ( 'ppfcz4', 'GW'), ( 'ppfcz4', 'HK'), ( 'ppfcz4', 'IN'),
+( 'ppfcz4', 'IQ'), ( 'ppfcz4', 'IR'), ( 'ppfcz4', 'JP'), ( 'ppfcz4', 'KE'),
+( 'ppfcz4', 'KG'), ( 'ppfcz4', 'KH'), ( 'ppfcz4', 'KP'), ( 'ppfcz4', 'KW'),
+( 'ppfcz4', 'KZ'), ( 'ppfcz4', 'LA'), ( 'ppfcz4', 'LK'), ( 'ppfcz4', 'LR'),
+( 'ppfcz4', 'LS'), ( 'ppfcz4', 'MG'), ( 'ppfcz4', 'ML'), ( 'ppfcz4', 'MM'),
+( 'ppfcz4', 'MN'), ( 'ppfcz4', 'MO'), ( 'ppfcz4', 'MR'), ( 'ppfcz4', 'MU'),
+( 'ppfcz4', 'MV'), ( 'ppfcz4', 'MW'), ( 'ppfcz4', 'MY'), ( 'ppfcz4', 'MZ'),
+( 'ppfcz4', 'NA'), ( 'ppfcz4', 'NE'), ( 'ppfcz4', 'NG'), ( 'ppfcz4', 'NP'),
+( 'ppfcz4', 'OM'), ( 'ppfcz4', 'PK'), ( 'ppfcz4', 'QA'), ( 'ppfcz4', 'RE'),
+( 'ppfcz4', 'RW'), ( 'ppfcz4', 'SA'), ( 'ppfcz4', 'SC'), ( 'ppfcz4', 'SD'),
+( 'ppfcz4', 'SG'), ( 'ppfcz4', 'SH'), ( 'ppfcz4', 'SL'), ( 'ppfcz4', 'SN'),
+( 'ppfcz4', 'SO'), ( 'ppfcz4', 'SZ'), ( 'ppfcz4', 'TD'), ( 'ppfcz4', 'TG'),
+( 'ppfcz4', 'TH'), ( 'ppfcz4', 'TJ'), ( 'ppfcz4', 'TM'), ( 'ppfcz4', 'TW'),
+( 'ppfcz4', 'TZ'), ( 'ppfcz4', 'UG'), ( 'ppfcz4', 'UZ'), ( 'ppfcz4', 'VN'),
+( 'ppfcz4', 'XU'), ( 'ppfcz4', 'YT'), ( 'ppfcz4', 'ZA'), ( 'ppfcz4', 'ZW'),
+( 'ppfcz5', 'AG'), ( 'ppfcz5', 'AI'), ( 'ppfcz5', 'AN'), ( 'ppfcz5', 'AP'),
+( 'ppfcz5', 'AQ'), ( 'ppfcz5', 'AR'), ( 'ppfcz5', 'AS'), ( 'ppfcz5', 'AU'),
+( 'ppfcz5', 'AW'), ( 'ppfcz5', 'BB'), ( 'ppfcz5', 'BM'), ( 'ppfcz5', 'BN'),
+( 'ppfcz5', 'BO'), ( 'ppfcz5', 'BR'), ( 'ppfcz5', 'BS'), ( 'ppfcz5', 'BZ'),
+( 'ppfcz5', 'CC'), ( 'ppfcz5', 'CD'), ( 'ppfcz5', 'CK'), ( 'ppfcz5', 'CL'),
+( 'ppfcz5', 'CO'), ( 'ppfcz5', 'CR'), ( 'ppfcz5', 'CU'), ( 'ppfcz5', 'CV'),
+( 'ppfcz5', 'CX'), ( 'ppfcz5', 'DM'), ( 'ppfcz5', 'EC'), ( 'ppfcz5', 'EH'),
+( 'ppfcz5', 'FJ'), ( 'ppfcz5', 'FK'), ( 'ppfcz5', 'FM'), ( 'ppfcz5', 'GD'),
+( 'ppfcz5', 'GF'), ( 'ppfcz5', 'GP'), ( 'ppfcz5', 'GS'), ( 'ppfcz5', 'GT'),
+( 'ppfcz5', 'GU'), ( 'ppfcz5', 'GY'), ( 'ppfcz5', 'HM'), ( 'ppfcz5', 'HN'),
+( 'ppfcz5', 'HT'), ( 'ppfcz5', 'ID'), ( 'ppfcz5', 'IO'), ( 'ppfcz5', 'JM'),
+( 'ppfcz5', 'KI'), ( 'ppfcz5', 'KM'), ( 'ppfcz5', 'KN'), ( 'ppfcz5', 'KR'),
+( 'ppfcz5', 'KY'), ( 'ppfcz5', 'LC'), ( 'ppfcz5', 'ME'), ( 'ppfcz5', 'MH'),
+( 'ppfcz5', 'MP'), ( 'ppfcz5', 'MQ'), ( 'ppfcz5', 'MS'), ( 'ppfcz5', 'NC'),
+( 'ppfcz5', 'NF'), ( 'ppfcz5', 'NI'), ( 'ppfcz5', 'NR'), ( 'ppfcz5', 'NU'),
+( 'ppfcz5', 'NZ'), ( 'ppfcz5', 'PA'), ( 'ppfcz5', 'PE'), ( 'ppfcz5', 'PF'),
+( 'ppfcz5', 'PG'), ( 'ppfcz5', 'PH'), ( 'ppfcz5', 'PN'), ( 'ppfcz5', 'PR'),
+( 'ppfcz5', 'PS'), ( 'ppfcz5', 'PW'), ( 'ppfcz5', 'PY'), ( 'ppfcz5', 'SB'),
+( 'ppfcz5', 'SJ'), ( 'ppfcz5', 'SR'), ( 'ppfcz5', 'ST'), ( 'ppfcz5', 'SV'),
+( 'ppfcz5', 'TA'), ( 'ppfcz5', 'TC'), ( 'ppfcz5', 'TF'), ( 'ppfcz5', 'TK'),
+( 'ppfcz5', 'TO'), ( 'ppfcz5', 'TP'), ( 'ppfcz5', 'TT'), ( 'ppfcz5', 'TV'),
+( 'ppfcz5', 'UM'), ( 'ppfcz5', 'UY'), ( 'ppfcz5', 'VC'), ( 'ppfcz5', 'VE'),
+( 'ppfcz5', 'VG'), ( 'ppfcz5', 'VI'), ( 'ppfcz5', 'VU'), ( 'ppfcz5', 'WF'),
+( 'ppfcz5', 'WS'), ( 'ppfcz5', 'YE'), ( 'ppfcz5', 'ZM'), ( 'ppfcz5', 'ZR');
+
+INSERT INTO t2 (a, b, c, d) VALUES
+('domestic', 26, 0.25, 4.7), ('domestic', 27, 0.25, 6),
+('domestic', 19, 2, 6.3), ('domestic', 19, 5, 7.77),
+('domestic', 19, 10, 10.3), ('domestic', 19, 20, 14.83),
+('domestic', 19, 30, 20.88), ('domestic', 20, 2, 7.3),
+('domestic', 20, 5, 8.77), ('domestic', 20, 10, 11.3),
+('domestic', 20, 20, 15.83), ('domestic', 20, 30, 21.88),
+('domestic', 23, 2, 18.8), ('domestic', 23, 5, 20.8),
+('domestic', 23, 10, 24.8), ('domestic', 23, 20, 27.8),
+('domestic', 23, 30, 30.8), ('domestic', 24, 2, 21.1405),
+('domestic', 24, 5, 22.3705), ('domestic', 24, 10, 25.0905),
+('domestic', 24, 20, 29.7705), ('domestic', 24, 30, 35.9605),
+('domestic', 17, 2, 7.2), ('domestic', 17, 5, 8.43),
+('domestic', 17, 10, 11.15), ('domestic', 17, 20, 15.83),
+('domestic', 17, 30, 22.02), ('domestic', 18, 2, 8.2),
+('domestic', 18, 5, 9.43), ('domestic', 18, 10, 12.15),
+('domestic', 18, 20, 16.83), ('domestic', 18, 30, 23.02),
+('domestic', 28, 2, 17), ('domestic', 28, 5, 19),
+('domestic', 28, 10, 22), ('domestic', 28, 20, 28),
+('domestic', 28, 30, 35), ('domestic', 29, 30, 29.5),
+('foreign', 25, 200, 0), ('domestic', 3, 100, 59),
+('foreign', 10, 30, 0), ('foreign', 22, 0, 0),
+('foreign', 11, 30, 0), ('foreign', 12, 30, 0),
+('all', 1, 10000, 0), ('all', 2, 10000, 0),
+('domestic', 9, 10000, 0), ('domestic', 4, 500, 0),
+('domestic', 5, 500, 0), ('domestic', 6, 500, 0),
+('domestic', 7, 500, 0), ('domestic', 8, 500, 0),
+('domestic', 21, 3.9, 10.8), ('domestic', 21, 4.9, 12.2),
+('domestic', 21, 9.9, 15.3), ('domestic', 21, 19.9, 20.6),
+('domestic', 21, 30, 28.1), ('plfcz1', 16, 0.5, 19),
+('plfcz2', 16, 0.5, 25), ( 'ppfcz2', 15, 16, 76.5),
+( 'ppfcz2', 15, 15, 75.5), ( 'ppfcz2', 15, 14, 73.5),
+( 'ppfcz2', 15, 13, 71.5), ( 'ppfcz2', 15, 12, 69.5),
+( 'ppfcz2', 15, 11, 67.5), ( 'ppfcz2', 15, 10, 65.5),
+( 'ppfcz2', 15, 9, 62.5), ( 'ppfcz2', 15, 8, 59.5),
+( 'ppfcz2', 15, 7, 56.5), ( 'ppfcz2', 15, 6, 53.5),
+( 'ppfcz2', 15, 5, 50.5), ( 'ppfcz2', 15, 4, 46.5),
+( 'ppfcz2', 15, 3, 42.5), ( 'ppfcz2', 15, 2, 38.5),
+('ppfcz1', 15, 2, 33.5), ('ppfcz1', 15, 3, 36.5),
+('ppfcz1', 15, 4, 39.5), ('ppfcz1', 15, 5, 41.5),
+('ppfcz1', 15, 6, 42.5), ('ppfcz1', 15, 7, 43.5),
+('ppfcz1', 15, 8, 44.5), ('ppfcz1', 15, 9, 45.5),
+('ppfcz1', 15, 10, 46.5), ('ppfcz1', 15, 11, 47.5),
+( 'ppfcz1', 15, 12, 48.5), ( 'ppfcz1', 15, 13, 49.5), ( 'ppfcz1', 15, 14, 50.5),
+( 'ppfcz1', 15, 15, 51.5), ( 'ppfcz1', 15, 16, 52.5), ( 'ppfcz1', 15, 17, 53.5),
+( 'ppfcz1', 15, 18, 54.5), ( 'ppfcz1', 15, 19, 55.5), ( 'ppfcz1', 15, 20, 56.5),
+( 'ppfcz1', 15, 21, 57.5), ( 'ppfcz1', 15, 22, 58.5), ( 'ppfcz1', 15, 23, 59.5),
+( 'ppfcz1', 15, 24, 60.5), ( 'ppfcz1', 15, 25, 61.5), ( 'ppfcz1', 15, 26, 62.5),
+( 'ppfcz1', 15, 27, 63.5), ( 'ppfcz1', 15, 28, 64.5), ( 'ppfcz1', 15, 29, 65.5),
+( 'ppfcz1', 15, 30, 66.5), ( 'ppfcz2', 15, 17, 77.5), ( 'ppfcz2', 15, 18, 78.5),
+( 'ppfcz2', 15, 19, 79.5), ( 'ppfcz2', 15, 20, 80.5), ( 'ppfcz2', 15, 21, 81.5),
+( 'ppfcz2', 15, 22, 82.5), ( 'ppfcz2', 15, 23, 83.5), ( 'ppfcz2', 15, 24, 84.5),
+( 'ppfcz2', 15, 25, 85.5), ( 'ppfcz2', 15, 26, 86.5), ( 'ppfcz2', 15, 27, 87.5),
+( 'ppfcz2', 15, 28, 88.5), ( 'ppfcz2', 15, 29, 89.5), ( 'ppfcz2', 15, 30, 90.5),
+( 'ppfcz3', 15, 2, 39.5), ( 'ppfcz3', 15, 3, 45.5), ( 'ppfcz3', 15, 4, 51.5),
+( 'ppfcz3', 15, 5, 57.5), ( 'ppfcz3', 15, 6, 63.5), ( 'ppfcz3', 15, 7, 69.5),
+( 'ppfcz3', 15, 8, 75.5), ( 'ppfcz3', 15, 9, 81.5), ( 'ppfcz3', 15, 10, 87.5),
+( 'ppfcz3', 15, 11, 93.5), ( 'ppfcz3', 15, 12, 99.5), ( 'ppfcz3', 15, 13, 105.5),
+( 'ppfcz3', 15, 14, 111.5), ( 'ppfcz3', 15, 15, 117.5), ( 'ppfcz3', 15, 16, 122.5),
+( 'ppfcz3', 15, 17, 127.5), ( 'ppfcz3', 15, 18, 132.5), ( 'ppfcz3', 15, 19, 137.5),
+( 'ppfcz3', 15, 20, 142.5), ( 'ppfcz3', 15, 21, 146.5), ( 'ppfcz3', 15, 22, 150.5),
+( 'ppfcz3', 15, 23, 154.5), ( 'ppfcz3', 15, 24, 158.5), ( 'ppfcz3', 15, 25, 162.5),
+( 'ppfcz3', 15, 26, 166.5), ( 'ppfcz3', 15, 27, 170.5), ( 'ppfcz3', 15, 28, 174.5),
+( 'ppfcz3', 15, 29, 178.5), ( 'ppfcz3', 15, 30, 182.5), ( 'ppfcz4', 15, 2, 44.5),
+( 'ppfcz4', 15, 3, 51.5), ( 'ppfcz4', 15, 4, 58.5), ( 'ppfcz4', 15, 5, 65.5),
+( 'ppfcz4', 15, 6, 72.5), ( 'ppfcz4', 15, 7, 79.5), ( 'ppfcz4', 15, 8, 86.5),
+( 'ppfcz4', 15, 9, 93.5), ( 'ppfcz4', 15, 10, 100.5), ( 'ppfcz4', 15, 11, 105.5),
+( 'ppfcz4', 15, 12, 110.5), ( 'ppfcz4', 15, 13, 115.5), ( 'ppfcz4', 15, 14, 120.5),
+( 'ppfcz4', 15, 15, 125.5), ( 'ppfcz4', 15, 16, 130.5), ( 'ppfcz4', 15, 17, 135.5),
+( 'ppfcz4', 15, 18, 140.5), ( 'ppfcz4', 15, 19, 145.5), ( 'ppfcz4', 15, 20, 150.5),
+( 'ppfcz4', 15, 21, 154.5), ( 'ppfcz4', 15, 22, 158.5), ( 'ppfcz4', 15, 23, 162.5),
+( 'ppfcz4', 15, 24, 166.5), ( 'ppfcz4', 15, 25, 170.5), ( 'ppfcz4', 15, 26, 174.5),
+( 'ppfcz4', 15, 27, 178.5), ( 'ppfcz4', 15, 28, 182.5), ( 'ppfcz4', 15, 29, 186.5),
+( 'ppfcz4', 15, 30, 190.5), ( 'ppfcz5', 15, 2, 48.5), ( 'ppfcz5', 15, 3, 56.5),
+( 'ppfcz5', 15, 4, 64.5), ( 'ppfcz5', 15, 5, 72.5), ( 'ppfcz5', 15, 6, 80.5),
+( 'ppfcz5', 15, 7, 88.5), ( 'ppfcz5', 15, 8, 96.5), ( 'ppfcz5', 15, 9, 104.5),
+( 'ppfcz5', 15, 10, 112.5), ( 'ppfcz5', 15, 11, 119.5), ( 'ppfcz5', 15, 12, 126.5),
+( 'ppfcz5', 15, 13, 133.5), ( 'ppfcz5', 15, 14, 140.5), ( 'ppfcz5', 15, 15, 147.5),
+( 'ppfcz5', 15, 16, 153.5), ( 'ppfcz5', 15, 17, 161.5), ( 'ppfcz5', 15, 18, 167.5),
+( 'ppfcz5', 15, 19, 173.5), ( 'ppfcz5', 15, 20, 179.5), ( 'ppfcz5', 15, 21, 185.5),
+( 'ppfcz5', 15, 22, 191.5), ( 'ppfcz5', 15, 23, 197.5), ( 'ppfcz5', 15, 24, 203.5),
+( 'ppfcz5', 15, 25, 207.5), ( 'ppfcz5', 15, 26, 212.5), ( 'ppfcz5', 15, 27, 217.5),
+( 'ppfcz5', 15, 28, 222.5), ( 'ppfcz5', 15, 29, 227.5), ( 'ppfcz5', 15, 30, 232.5),
+( 'ppfcz1', 14, 2, 37.5), ( 'ppfcz1', 14, 3, 41.5), ( 'ppfcz1', 14, 4, 45.5),
+( 'ppfcz1', 14, 5, 48.5), ( 'ppfcz1', 14, 6, 52.5), ( 'ppfcz1', 14, 7, 55.5),
+( 'ppfcz1', 14, 8, 57.5), ( 'ppfcz1', 14, 9, 59.5), ( 'ppfcz1', 14, 10, 61.5),
+( 'ppfcz1', 14, 11, 62.5), ( 'ppfcz1', 14, 12, 63.5), ( 'ppfcz1', 14, 13, 64.5),
+( 'ppfcz1', 14, 14, 65.5), ( 'ppfcz1', 14, 15, 66.5), ( 'ppfcz1', 14, 16, 67.5),
+( 'ppfcz1', 14, 17, 68.5), ( 'ppfcz1', 14, 18, 69.5), ( 'ppfcz1', 14, 19, 70.5),
+( 'ppfcz1', 14, 20, 71.5), ( 'ppfcz1', 14, 21, 72.5), ( 'ppfcz1', 14, 22, 73.5),
+( 'ppfcz1', 14, 23, 74.5), ( 'ppfcz1', 14, 24, 75.5), ( 'ppfcz1', 14, 25, 76.5),
+( 'ppfcz1', 14, 26, 77.5), ( 'ppfcz1', 14, 27, 78.5), ( 'ppfcz1', 14, 28, 79.5),
+( 'ppfcz1', 14, 29, 80.5), ( 'ppfcz1', 14, 30, 81.5), ( 'ppfcz2', 14, 2, 43.5),
+( 'ppfcz2', 14, 3, 48.5), ( 'ppfcz2', 14, 4, 53.5), ( 'ppfcz2', 14, 5, 57.5),
+( 'ppfcz2', 14, 6, 61.5), ( 'ppfcz2', 14, 7, 65.5), ( 'ppfcz2', 14, 8, 69.5),
+( 'ppfcz2', 14, 9, 73.5), ( 'ppfcz2', 14, 10, 77.5), ( 'ppfcz2', 14, 11, 80.5),
+( 'ppfcz2', 14, 12, 83.5), ( 'ppfcz2', 14, 13, 86.5), ( 'ppfcz2', 14, 14, 89.5),
+( 'ppfcz2', 14, 15, 92.5), ( 'ppfcz2', 14, 16, 94.5), ( 'ppfcz2', 14, 17, 96.5),
+( 'ppfcz2', 14, 18, 98.5), ( 'ppfcz2', 14, 19, 99.5), ( 'ppfcz2', 14, 20, 100.5),
+( 'ppfcz2', 14, 21, 101.5), ( 'ppfcz2', 14, 22, 102.5), ( 'ppfcz2', 14, 23, 103.5),
+( 'ppfcz2', 14, 24, 104.5), ( 'ppfcz2', 14, 25, 105.5), ( 'ppfcz2', 14, 26, 106.5),
+( 'ppfcz2', 14, 27, 107.5), ( 'ppfcz2', 14, 28, 108.5), ( 'ppfcz2', 14, 29, 109.5),
+( 'ppfcz2', 14, 30, 110.5), ( 'ppfcz3', 14, 2, 47.5), ( 'ppfcz3', 14, 3, 56.5),
+( 'ppfcz3', 14, 4, 67.5), ( 'ppfcz3', 14, 5, 78.5), ( 'ppfcz3', 14, 6, 87.5),
+( 'ppfcz3', 14, 7, 96.5), ( 'ppfcz3', 14, 8, 105.5), ( 'ppfcz3', 14, 9, 114.5),
+( 'ppfcz3', 14, 10, 123.5), ( 'ppfcz3', 14, 11, 131.5), ( 'ppfcz3', 14, 12, 139.5),
+( 'ppfcz3', 14, 13, 147.5), ( 'ppfcz3', 14, 14, 155.5), ( 'ppfcz3', 14, 15, 163.5),
+( 'ppfcz3', 14, 16, 171.5), ( 'ppfcz3', 14, 17, 179.5), ( 'ppfcz3', 14, 18, 187.5),
+( 'ppfcz3', 14, 19, 195.5), ( 'ppfcz3', 14, 20, 203.5), ( 'ppfcz3', 14, 21, 210.5),
+( 'ppfcz3', 14, 22, 217.5), ( 'ppfcz3', 14, 23, 224.5), ( 'ppfcz3', 14, 24, 231.5),
+( 'ppfcz3', 14, 25, 238.5), ( 'ppfcz3', 14, 26, 245.5), ( 'ppfcz3', 14, 27, 252.5),
+( 'ppfcz3', 14, 28, 259.5), ( 'ppfcz3', 14, 29, 266.5), ( 'ppfcz3', 14, 30, 273.5),
+( 'ppfcz4', 14, 2, 54.5), ( 'ppfcz4', 14, 3, 68.5), ( 'ppfcz4', 14, 4, 81.5),
+( 'ppfcz4', 14, 5, 95.5), ( 'ppfcz4', 14, 6, 108.5), ( 'ppfcz4', 14, 7, 121.5),
+( 'ppfcz4', 14, 8, 134.5), ( 'ppfcz4', 14, 9, 147.5), ( 'ppfcz4', 14, 10, 160.5),
+( 'ppfcz4', 14, 11, 168.5), ( 'ppfcz4', 14, 12, 178.5), ( 'ppfcz4', 14, 13, 188.5),
+( 'ppfcz4', 14, 14, 198.5), ( 'ppfcz4', 14, 15, 208.5), ( 'ppfcz4', 14, 16, 216.5),
+( 'ppfcz4', 14, 17, 224.5), ( 'ppfcz4', 14, 18, 232.5), ( 'ppfcz4', 14, 19, 240.5),
+( 'ppfcz4', 14, 20, 248.5), ( 'ppfcz4', 14, 21, 256.5), ( 'ppfcz4', 14, 22, 264.5),
+( 'ppfcz4', 14, 23, 272.5), ( 'ppfcz4', 14, 24, 280.5), ( 'ppfcz4', 14, 25, 288.5),
+( 'ppfcz4', 14, 26, 296.5), ( 'ppfcz4', 14, 27, 304.5), ( 'ppfcz4', 14, 28, 312.5),
+( 'ppfcz4', 14, 29, 320.5), ( 'ppfcz4', 14, 30, 328.5), ( 'ppfcz5', 14, 2, 66.5),
+( 'ppfcz5', 14, 3, 84.5), ( 'ppfcz5', 14, 4, 102.5), ( 'ppfcz5', 14, 5, 120.5),
+( 'ppfcz5', 14, 6, 137.5), ( 'ppfcz5', 14, 7, 154.5), ( 'ppfcz5', 14, 8, 171.5),
+( 'ppfcz5', 14, 9, 188.5), ( 'ppfcz5', 14, 10, 205.5), ( 'ppfcz5', 14, 11, 220.5),
+( 'ppfcz5', 14, 12, 235.5), ( 'ppfcz5', 14, 13, 250.5), ( 'ppfcz5', 14, 14, 265.5),
+( 'ppfcz5', 14, 15, 280.5), ( 'ppfcz5', 14, 16, 295.5), ( 'ppfcz5', 14, 17, 310.5),
+( 'ppfcz5', 14, 18, 325.5), ( 'ppfcz5', 14, 19, 340.5), ( 'ppfcz5', 14, 20, 355.5),
+( 'ppfcz5', 14, 21, 368.5), ( 'ppfcz5', 14, 22, 381.5), ( 'ppfcz5', 14, 23, 394.5),
+( 'ppfcz5', 14, 24, 407.5), ( 'ppfcz5', 14, 25, 420.5), ( 'ppfcz5', 14, 26, 433.5),
+( 'ppfcz5', 14, 27, 446.5), ( 'ppfcz5', 14, 28, 459.5), ( 'ppfcz5', 14, 29, 472.5),
+( 'ppfcz5', 14, 30, 485.5), ( 'ppfcz1', 30, 0.5, 56.5), ( 'ppfcz1', 30, 1, 63.5),
+( 'ppfcz1', 30, 1.5, 69.5), ( 'ppfcz1', 30, 2, 75.5), ( 'ppfcz1', 30, 2.5, 80.5),
+( 'ppfcz1', 30, 3, 86.5), ( 'ppfcz1', 30, 3.5, 92.5), ( 'ppfcz1', 30, 4, 99.5),
+( 'ppfcz1', 30, 4.5, 105.5), ( 'ppfcz1', 30, 5, 111.5), ( 'ppfcz1', 30, 6, 118.5),
+( 'ppfcz1', 30, 7, 126.5), ( 'ppfcz1', 30, 8, 133.5), ( 'ppfcz1', 30, 9, 141.5),
+( 'ppfcz1', 30, 10, 148.5), ( 'ppfcz1', 30, 11, 156.5), ( 'ppfcz1', 30, 12, 163.5),
+( 'ppfcz1', 30, 13, 171.5), ( 'ppfcz1', 30, 14, 178.5), ( 'ppfcz1', 30, 15, 186.5),
+( 'ppfcz1', 30, 16, 193.5), ( 'ppfcz1', 30, 17, 201.5), ( 'ppfcz1', 30, 18, 209.5),
+( 'ppfcz1', 30, 19, 216.5), ( 'ppfcz1', 30, 20, 224.5), ( 'ppfcz1', 30, 21, 231.5),
+( 'ppfcz1', 30, 22, 239.5), ( 'ppfcz1', 30, 23, 246.5), ( 'ppfcz1', 30, 24, 254.5),
+( 'ppfcz1', 30, 25, 261.5), ( 'ppfcz1', 30, 26, 269.5), ( 'ppfcz1', 30, 27, 276.5),
+( 'ppfcz1', 30, 28, 284.5), ( 'ppfcz1', 30, 29, 291.5), ( 'ppfcz1', 30, 30, 299.5),
+( 'ppfcz2', 30, 0.5, 61.5), ( 'ppfcz2', 30, 1, 65.5), ( 'ppfcz2', 30, 1.5, 75.5),
+( 'ppfcz2', 30, 2, 80.5), ( 'ppfcz2', 30, 2.5, 86.5), ( 'ppfcz2', 30, 3, 99.5),
+( 'ppfcz2', 30, 3.5, 109.5), ( 'ppfcz2', 30, 4, 113.5), ( 'ppfcz2', 30, 4.5, 121.5),
+( 'ppfcz2', 30, 5, 129.5), ( 'ppfcz2', 30, 6, 139.5), ( 'ppfcz2', 30, 7, 149.5),
+( 'ppfcz2', 30, 8, 159.5), ( 'ppfcz2', 30, 9, 169.5), ( 'ppfcz2', 30, 10, 180.5),
+( 'ppfcz2', 30, 11, 189.5), ( 'ppfcz2', 30, 12, 199.5), ( 'ppfcz2', 30, 13, 210.5),
+( 'ppfcz2', 30, 14, 219.5), ( 'ppfcz2', 30, 15, 229.5), ( 'ppfcz2', 30, 16, 240.5),
+( 'ppfcz2', 30, 17, 249.5), ( 'ppfcz2', 30, 18, 259.5), ( 'ppfcz2', 30, 19, 270.5),
+( 'ppfcz2', 30, 20, 280.5), ( 'ppfcz2', 30, 21, 289.5), ( 'ppfcz2', 30, 22, 300.5),
+( 'ppfcz2', 30, 23, 310.5), ( 'ppfcz2', 30, 24, 320.5), ( 'ppfcz2', 30, 25, 330.5),
+( 'ppfcz2', 30, 26, 340.5), ( 'ppfcz2', 30, 27, 350.5), ( 'ppfcz2', 30, 28, 360.5),
+( 'ppfcz2', 30, 29, 370.5), ( 'ppfcz2', 30, 30, 381.5), ( 'ppfcz3', 30, 0.5, 74.5),
+( 'ppfcz3', 30, 1, 83.5), ( 'ppfcz3', 30, 1.5, 90.5), ( 'ppfcz3', 30, 2, 99.5),
+( 'ppfcz3', 30, 2.5, 107.5), ( 'ppfcz3', 30, 3, 114.5), ( 'ppfcz3', 30, 3.5, 122.5),
+( 'ppfcz3', 30, 4, 130.5), ( 'ppfcz3', 30, 4.5, 140.5), ( 'ppfcz3', 30, 5, 147.5),
+( 'ppfcz3', 30, 6, 162.5), ( 'ppfcz3', 30, 7, 174.5), ( 'ppfcz3', 30, 8, 188.5),
+( 'ppfcz3', 30, 9, 201.5), ( 'ppfcz3', 30, 10, 213.5), ( 'ppfcz3', 30, 11, 227.5),
+( 'ppfcz3', 30, 12, 240.5), ( 'ppfcz3', 30, 13, 252.5), ( 'ppfcz3', 30, 14, 266.5),
+( 'ppfcz3', 30, 15, 278.5), ( 'ppfcz3', 30, 16, 290.5), ( 'ppfcz3', 30, 17, 304.5),
+( 'ppfcz3', 30, 18, 317.5), ( 'ppfcz3', 30, 19, 330.5), ( 'ppfcz3', 30, 20, 343.5),
+( 'ppfcz3', 30, 21, 354.5), ( 'ppfcz3', 30, 22, 363.5), ( 'ppfcz3', 30, 23, 375.5),
+( 'ppfcz3', 30, 24, 385.5), ( 'ppfcz3', 30, 25, 396.5), ( 'ppfcz3', 30, 26, 405.5),
+( 'ppfcz3', 30, 27, 417.5), ( 'ppfcz3', 30, 28, 428.5), ( 'ppfcz3', 30, 29, 438.5),
+( 'ppfcz3', 30, 30, 448.5), ( 'ppfcz4', 30, 0.5, 90.5), ( 'ppfcz4', 30, 1, 104.5),
+( 'ppfcz4', 30, 1.5, 118.5), ( 'ppfcz4', 30, 2, 134.5), ( 'ppfcz4', 30, 2.5, 146.5),
+( 'ppfcz4', 30, 3, 163.5), ( 'ppfcz4', 30, 3.5, 179.5), ( 'ppfcz4', 30, 4, 195.5),
+( 'ppfcz4', 30, 4.5, 211.5), ( 'ppfcz4', 30, 5, 232.5), ( 'ppfcz4', 30, 6, 257.5),
+( 'ppfcz4', 30, 7, 278.5), ( 'ppfcz4', 30, 8, 300.5), ( 'ppfcz4', 30, 9, 321.5),
+( 'ppfcz4', 30, 10, 343.5), ( 'ppfcz4', 30, 11, 364.5), ( 'ppfcz4', 30, 12, 386.5),
+( 'ppfcz4', 30, 13, 407.5), ( 'ppfcz4', 30, 14, 429.5), ( 'ppfcz4', 30, 15, 450.5),
+( 'ppfcz4', 30, 16, 472.5), ( 'ppfcz4', 30, 17, 493.5), ( 'ppfcz4', 30, 18, 515.5),
+( 'ppfcz4', 30, 19, 536.5), ( 'ppfcz4', 30, 20, 558.5), ( 'ppfcz4', 30, 21, 579.5),
+( 'ppfcz4', 30, 22, 601.5), ( 'ppfcz4', 30, 23, 622.5), ( 'ppfcz4', 30, 24, 644.5),
+( 'ppfcz4', 30, 25, 665.5), ( 'ppfcz4', 30, 26, 687.5), ( 'ppfcz4', 30, 27, 708.5),
+( 'ppfcz4', 30, 28, 730.5), ( 'ppfcz4', 30, 29, 751.5), ( 'ppfcz4', 30, 30, 773.5),
+( 'ppfcz5', 30, 0.5, 97.5), ( 'ppfcz5', 30, 1, 114.5), ( 'ppfcz5', 30, 1.5, 131.5),
+( 'ppfcz5', 30, 2, 148.5), ( 'ppfcz5', 30, 2.5, 165.5), ( 'ppfcz5', 30, 3, 183.5),
+( 'ppfcz5', 30, 3.5, 200.5), ( 'ppfcz5', 30, 4, 221.5), ( 'ppfcz5', 30, 4.5, 243.5),
+( 'ppfcz5', 30, 5, 264.5), ( 'ppfcz5', 30, 6, 289.5), ( 'ppfcz5', 30, 7, 313.5),
+( 'ppfcz5', 30, 8, 336.5), ( 'ppfcz5', 30, 9, 360.5), ( 'ppfcz5', 30, 10, 384.5),
+( 'ppfcz5', 30, 11, 407.5), ( 'ppfcz5', 30, 12, 431.5), ( 'ppfcz5', 30, 13, 455.5),
+( 'ppfcz5', 30, 14, 478.5), ( 'ppfcz5', 30, 15, 502.5), ( 'ppfcz5', 30, 16, 526.5),
+( 'ppfcz5', 30, 17, 549.5), ( 'ppfcz5', 30, 18, 573.5), ( 'ppfcz5', 30, 19, 597.5),
+( 'ppfcz5', 30, 20, 620.5), ( 'ppfcz5', 30, 21, 644.5), ( 'ppfcz5', 30, 22, 668.5),
+( 'ppfcz5', 30, 23, 691.5), ( 'ppfcz5', 30, 24, 715.5), ( 'ppfcz5', 30, 25, 738.5),
+( 'ppfcz5', 30, 26, 762.5), ( 'ppfcz5', 30, 27, 786.5), ( 'ppfcz5', 30, 28, 809.5),
+( 'ppfcz5', 30, 29, 833.5), ( 'ppfcz5', 30, 30, 857.5), ( 'foreign', 13, 30, 0),
+( 'all', 32, 10000, 23.2342007434944);
+
+--enable_query_log
+
+INSERT INTO t3 SELECT * FROM t1;
+
+EXPLAIN
+SELECT d FROM t1, t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
+ORDER BY t2.c LIMIT 1;
+SELECT d FROM t1, t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
+ORDER BY t2.c LIMIT 1;
+
+EXPLAIN
+SELECT d FROM t3 AS t1, t2 AS t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
+ORDER BY t2.c LIMIT 1;
+SELECT d FROM t3 AS t1, t2 AS t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
+ORDER BY t2.c LIMIT 1;
+
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 4d81400889f..c4e447988db 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -14,6 +14,10 @@
drop table if exists t1;
--enable_warnings
+--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+create table t1 (a int) partition by list ((a/3)*10 div 1)
+(partition p0 values in (0), partition p1 values in (1));
+
#
# Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
#
@@ -35,7 +39,7 @@ PARTITION `p5` VALUES LESS THAN (2010)
COMMENT 'APSTART \' APEND'
);
#--exec sed 's/APSTART \\/APSTART /' var/master-data/test/t1.frm > tmpt1.frm && mv tmpt1.frm var/master-data/test/t1.frm
-#--error 1064
+#--error ER_PARSE_ERROR
SELECT * FROM t1 LIMIT 1;
DROP TABLE t1;
@@ -49,6 +53,7 @@ create table t1 (id int auto_increment, s1 int, primary key (id));
insert into t1 values (null,1);
insert into t1 values (null,6);
+-- sorted_result
select * from t1;
alter table t1 partition by range (id) (
@@ -79,24 +84,6 @@ partition by key(a)
partitions 1e+300;
#
-# Bug 21350: Data Directory problems
-#
--- error ER_WRONG_TABLE_NAME
-create table t1 (a int)
-partition by key (a)
-(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
-
-#
-# Insert a test that manages to create the first partition and fails with
-# the second, ensure that we clean up afterwards in a proper manner.
-#
---error ER_WRONG_TABLE_NAME
-create table t1 (a int)
-partition by key (a)
-(partition p0,
- partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
-
-#
# Bug 19309 Partitions: Crash if double procedural alter
#
create table t1 (a int)
@@ -618,12 +605,14 @@ partition by key (a)
(partition p0, partition p1);
show create table t1;
---error ER_MIX_HANDLER_ERROR
+# Since alter, it already have ENGINE=HEAP from before on table level
+# -> OK
alter table t1
partition by key(a)
(partition p0, partition p1 engine=heap);
---error ER_MIX_HANDLER_ERROR
+# Since alter, it already have ENGINE=HEAP from before on table level
+# -> OK
alter table t1
partition by key(a)
(partition p0 engine=heap, partition p1);
@@ -1208,9 +1197,11 @@ SHOW TABLE STATUS;
DELETE from t1 where a = 1;
--replace_column 9 0 12 NULL 13 NULL 14 NULL
SHOW TABLE STATUS;
+# restore this after WL#4176 is completed
+-- error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 OPTIMIZE PARTITION p0;
---replace_column 12 NULL 13 NULL 14 NULL
-SHOW TABLE STATUS;
+#--replace_column 12 NULL 13 NULL 14 NULL
+#SHOW TABLE STATUS;
DROP TABLE t1;
#
@@ -1224,13 +1215,15 @@ DROP TABLE t1;
#
# Bug 17455 Partitions: Wrong message and error when using Repair/Optimize
# table on partitioned table
-#
+# (added check/analyze for gcov of Bug#20129)
create table t1 (a int)
engine=MEMORY
partition by key (a);
REPAIR TABLE t1;
OPTIMIZE TABLE t1;
+CHECK TABLE t1;
+ANALYZE TABLE t1;
drop table t1;
@@ -1399,37 +1392,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
drop table t1, t2;
#
-# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
-#
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-disable_query_log;
-eval create table t2 (i int )
-partition by range (i)
-(
- partition p01 values less than (1000)
- data directory="$MYSQLD_DATADIR/test/"
- index directory="$MYSQLD_DATADIR/test/"
-);
-enable_query_log;
-
-set @org_mode=@@sql_mode;
-set @@sql_mode='NO_DIR_IN_CREATE';
-select @@sql_mode;
-create table t1 (i int )
-partition by range (i)
-(
- partition p01 values less than (1000)
- data directory='/not/existing'
- index directory='/not/existing'
-);
-
-show create table t2;
-DROP TABLE t1, t2;
-set @@sql_mode=@org_mode;
-
-#
# Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table>
#
create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
@@ -1564,16 +1526,24 @@ select c1 from t1 group by (select c0 from t1 limit 1);
drop table t1;
# Bug #30495: optimize table t1,t2,t3 extended errors
-#
+# (added more maintenace commands for Bug#20129
CREATE TABLE t1(a int)
PARTITION BY RANGE (a) (
PARTITION p1 VALUES LESS THAN (10),
PARTITION p2 VALUES LESS THAN (20)
);
---error 1064
+--error ER_PARSE_ERROR
ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
---error 1064
+--error ER_PARSE_ERROR
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 ANALYZE PARTITION p1;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 CHECK PARTITION p1;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 REPAIR PARTITION p1;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 OPTIMIZE PARTITION p1;
DROP TABLE t1;
#
diff --git a/mysql-test/t/partition_datatype.test b/mysql-test/t/partition_datatype.test
index 61d3cb42c7b..7440a9bf3a3 100644
--- a/mysql-test/t/partition_datatype.test
+++ b/mysql-test/t/partition_datatype.test
@@ -11,11 +11,11 @@
drop table if exists t1;
--enable_warnings
-# FIXME: disabled this test because of valgrind error
-#create table t1 (a bit not null) partition by key (a);
-#insert into t1 values (b'1');
-#select * from t1 where a = b'1';
-#drop table t1;
+-- echo # test with not null
+create table t1 (a bit not null) partition by key (a);
+insert into t1 values (b'1');
+select hex(a) from t1 where a = b'1';
+drop table t1;
create table t1 (a tinyint not null) partition by key (a);
insert into t1 values (2);
select * from t1 where a = 2;
@@ -37,14 +37,14 @@ insert into t1 values (2);
select * from t1 where a = 2;
drop table t1;
create table t1 (a float not null) partition by key (a);
-insert into t1 values (2.1);
-select * from t1 where a = 2.1;
+insert into t1 values (0.5);
+select * from t1 where a = 0.5;
drop table t1;
create table t1 (a double not null) partition by key (a);
-insert into t1 values (2.1);
-select * from t1 where a = 2.1;
+insert into t1 values (0.5);
+select * from t1 where a = 0.5;
drop table t1;
-create table t1 (a decimal not null) partition by key (a);
+create table t1 (a decimal(4,2) not null) partition by key (a);
insert into t1 values (2.1);
select * from t1 where a = 2.1;
drop table t1;
@@ -100,11 +100,14 @@ create table t1 (a set('y','n') not null) partition by key (a);
insert into t1 values ('y');
select * from t1 where a = 'y';
drop table t1;
-# FIXME: disabled this test because of valgrind error
-#create table t1 (a bit) partition by key (a);
-#insert into t1 values (b'1');
-#select * from t1 where a = b'1';
-#drop table t1;
+-- echo # test with null allowed
+create table t1 (a bit) partition by key (a);
+insert into t1 values (b'1');
+insert into t1 values (NULL);
+select hex(a) from t1 where a = b'1';
+select hex(a) from t1 where a is NULL;
+select hex(a) from t1 order by a;
+drop table t1;
create table t1 (a tinyint) partition by key (a);
insert into t1 values (2);
select * from t1 where a = 2;
@@ -126,14 +129,14 @@ insert into t1 values (2);
select * from t1 where a = 2;
drop table t1;
create table t1 (a float) partition by key (a);
-insert into t1 values (2.1);
-select * from t1 where a = 2.1;
+insert into t1 values (0.5);
+select * from t1 where a = 0.5;
drop table t1;
create table t1 (a double) partition by key (a);
-insert into t1 values (2.1);
-select * from t1 where a = 2.1;
+insert into t1 values (0.5);
+select * from t1 where a = 0.5;
drop table t1;
-create table t1 (a decimal) partition by key (a);
+create table t1 (a decimal(4,2)) partition by key (a);
insert into t1 values (2.1);
select * from t1 where a = 2.1;
drop table t1;
@@ -192,18 +195,23 @@ drop table t1;
create table t1 (a varchar(65531)) partition by key (a);
insert into t1 values ('bbbb');
insert into t1 values ('aaaa');
-select * from t1 where a = 'aaa%';
+select * from t1 where a = 'aaaa';
select * from t1 where a like 'aaa%';
+select * from t1 where a = 'bbbb';
drop table t1;
create table t1 (a varchar(65532)) partition by key (a);
insert into t1 values ('bbbb');
insert into t1 values ('aaaa');
-select * from t1 where a = 'aaa%';
+select * from t1 where a = 'aaaa';
select * from t1 where a like 'aaa%';
+select * from t1 where a = 'bbbb';
drop table t1;
create table t1 (a varchar(65533) not null) partition by key (a);
+insert into t1 values ('bbbb');
insert into t1 values ('aaaa');
-select * from t1 where a = 'aaa%';
+select * from t1 where a = 'aaaa';
+select * from t1 where a like 'aaa%';
+select * from t1 where a = 'bbbb';
drop table t1;
-- error ER_TOO_BIG_ROWSIZE
create table t1 (a varchar(65533)) partition by key (a);
@@ -211,3 +219,14 @@ create table t1 (a varchar(65533)) partition by key (a);
create table t1 (a varchar(65534) not null) partition by key (a);
-- error ER_TOO_BIG_ROWSIZE
create table t1 (a varchar(65535)) partition by key (a);
+
+#
+# Bug#34358: error in key_restore for bitfields with uneven bits
+#
+create table t1 (a bit(27), primary key (a)) engine=myisam
+partition by hash (a)
+(partition p0, partition p1, partition p2);
+show create table t1;
+insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
+select hex(a) from t1 where a = 7;
+drop table t1;
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index 37fef050147..41b904b876f 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -9,6 +9,24 @@ drop table if exists t1;
--enable_warnings
#
+# Bug#31931: Mix of handlers error message
+#
+--error ER_MIX_HANDLER_ERROR
+CREATE TABLE t1 (a INT)
+PARTITION BY HASH (a)
+( PARTITION p0 ENGINE=MyISAM,
+ PARTITION p1);
+--error ER_MIX_HANDLER_ERROR
+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));
+
+
+#
# Bug 29368:
# Incorrect error, 1467, for syntax error when creating partition
--error ER_PARTITION_REQUIRES_VALUES_ERROR
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 76a54b36942..932855cc877 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -104,6 +104,7 @@ engine = innodb
partition by list (a)
(partition p0 values in (0));
+-- error ER_MIX_HANDLER_ERROR
alter table t1 engine = x;
show create table t1;
drop table t1;
@@ -182,8 +183,10 @@ DROP TABLE t1;
create table t1 (int_column int, char_column char(5))
PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB);
-alter table t1 PARTITION BY RANGE (int_column)
+alter table t1
+ENGINE = MyISAM
+PARTITION BY RANGE (int_column)
subpartition by key (char_column) subpartitions 2
- (PARTITION p1 VALUES LESS THAN (5) ENGINE = myisam);
+ (PARTITION p1 VALUES LESS THAN (5));
show create table t1;
drop table t1;
diff --git a/mysql-test/t/partition_not_windows.test b/mysql-test/t/partition_not_windows.test
index 4e285535677..d7108d5af98 100644
--- a/mysql-test/t/partition_not_windows.test
+++ b/mysql-test/t/partition_not_windows.test
@@ -11,66 +11,122 @@
# Bug 20770 Partitions: DATA DIRECTORY clause change in reorganize
# doesn't remove old directory
---disable_query_log
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec mkdir $MYSQLD_DATADIR/tmpdata || true
-eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLD_DATADIR/tmpdata''';
-let $data_directory = `select @data_dir`;
-
---exec mkdir $MYSQLD_DATADIR/tmpinx || true
-eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLD_DATADIR/tmpinx''';
-let $inx_directory = `select @inx_dir`;
---enable_query_log
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+let $data_directory = DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
+
+let $inx_directory = INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create table t1 (a int) engine myisam
partition by range (a)
subpartition by hash (a)
(partition p0 VALUES LESS THAN (1) $data_directory $inx_directory
(SUBPARTITION subpart00, SUBPARTITION subpart01));
---echo Checking if file exists before alter
---file_exists $MYSQLD_DATADIR/test/t1.frm
---file_exists $MYSQLD_DATADIR/test/t1.par
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYI
---file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p0#SP#subpart01.MYI
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--echo # Checking if file exists before alter
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYI
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(partition p1 VALUES LESS THAN (1) $data_directory $inx_directory
(SUBPARTITION subpart10, SUBPARTITION subpart11),
partition p2 VALUES LESS THAN (2) $data_directory $inx_directory
(SUBPARTITION subpart20, SUBPARTITION subpart21));
---echo Checking if file exists after alter
---file_exists $MYSQLD_DATADIR/test/t1.frm
---file_exists $MYSQLD_DATADIR/test/t1.par
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYI
---file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p2#SP#subpart21.MYI
+--echo # Checking if file exists after alter
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYI
drop table t1;
---exec rmdir $MYSQLD_DATADIR/tmpdata || true
---exec rmdir $MYSQLD_DATADIR/tmpinx || true
+
+#
+# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
+#
+disable_query_log;
+eval create table t2 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory="$MYSQLTEST_VARDIR/tmp/"
+ index directory="$MYSQLTEST_VARDIR/tmp/"
+);
+enable_query_log;
+
+set @org_mode=@@sql_mode;
+set @@sql_mode='NO_DIR_IN_CREATE';
+select @@sql_mode;
+create table t1 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory='/not/existing'
+ index directory='/not/existing'
+);
+show create table t2;
+DROP TABLE t1, t2;
+set @@sql_mode=@org_mode;
+
+#
+# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
+#
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLE t1(a INT)
+PARTITION BY KEY (a)
+(PARTITION p0 DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test');
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLE t1(a INT)
+PARTITION BY KEY (a)
+(PARTITION p0 INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test');
+
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLE ts (id INT, purchased DATE)
+PARTITION BY RANGE(YEAR(purchased))
+SUBPARTITION BY HASH(TO_DAYS(purchased)) (
+PARTITION p0 VALUES LESS THAN (1990) (
+SUBPARTITION s0a
+ DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test',
+SUBPARTITION s0b
+ DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test'
+));
+
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLE ts (id INT, purchased DATE)
+PARTITION BY RANGE(YEAR(purchased))
+SUBPARTITION BY HASH(TO_DAYS(purchased)) (
+PARTITION p0 VALUES LESS THAN (1990) (
+SUBPARTITION s0a
+ INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test',
+SUBPARTITION s0b
+ INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test'
+));
# End Windows specific test failures.
@@ -84,18 +140,68 @@ drop table t1;
DROP TABLE IF EXISTS `example`;
--enable_warnings
---disable_abort_on_error
-CREATE TABLE `example` (
+--mkdir $MYSQLTEST_VARDIR/p0Data
+--mkdir $MYSQLTEST_VARDIR/p1Data
+--mkdir $MYSQLTEST_VARDIR/p2Data
+--mkdir $MYSQLTEST_VARDIR/p3Data
+--mkdir $MYSQLTEST_VARDIR/p0Index
+--mkdir $MYSQLTEST_VARDIR/p1Index
+--mkdir $MYSQLTEST_VARDIR/p2Index
+--mkdir $MYSQLTEST_VARDIR/p3Index
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE `example` (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`ID_EXAMPLE`)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
-PARTITION p0 DATA DIRECTORY = '/build/5.1/data/partitiontest/p0Data',
-PARTITION p1 DATA DIRECTORY = '/build/5.1/data/partitiontest/p1Data',
-PARTITION p2 DATA DIRECTORY = '/build/5.1/data/partitiontest/p2Data',
-PARTITION p3 DATA DIRECTORY = '/build/5.1/data/partitiontest/p3Data'
+PARTITION p0 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p0Data'
+INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p0Index',
+PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p1Data'
+INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p1Index',
+PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p2Data'
+INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p2Index',
+PARTITION p3 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p3Data'
+INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p3Index'
);
---enable_abort_on_error
+--echo # Checking that MyISAM .MYD and .MYI are in test db and data/idx dir
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p0.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p0.MYD
+--file_exists $MYSQLTEST_VARDIR/p0Data/example#P#p0.MYD
+--file_exists $MYSQLTEST_VARDIR/p0Index/example#P#p0.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p1.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p1.MYD
+--file_exists $MYSQLTEST_VARDIR/p1Data/example#P#p1.MYD
+--file_exists $MYSQLTEST_VARDIR/p1Index/example#P#p1.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p2.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p2.MYD
+--file_exists $MYSQLTEST_VARDIR/p2Data/example#P#p2.MYD
+--file_exists $MYSQLTEST_VARDIR/p2Index/example#P#p2.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p3.MYI
+--file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p3.MYD
+--file_exists $MYSQLTEST_VARDIR/p3Data/example#P#p3.MYD
+--file_exists $MYSQLTEST_VARDIR/p3Index/example#P#p3.MYI
+DROP TABLE example;
+--rmdir $MYSQLTEST_VARDIR/p0Data
+--rmdir $MYSQLTEST_VARDIR/p1Data
+--rmdir $MYSQLTEST_VARDIR/p2Data
+--rmdir $MYSQLTEST_VARDIR/p3Data
+--rmdir $MYSQLTEST_VARDIR/p0Index
+--rmdir $MYSQLTEST_VARDIR/p1Index
+--rmdir $MYSQLTEST_VARDIR/p2Index
+--rmdir $MYSQLTEST_VARDIR/p3Index
+--error ER_CANT_CREATE_TABLE,1
+CREATE TABLE `example` (
+ `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `DESCRIPTION` varchar(30) NOT NULL,
+ `LEVEL` smallint(5) unsigned DEFAULT NULL,
+ PRIMARY KEY (`ID_EXAMPLE`)
+) ENGINE = MYISAM
+PARTITION BY HASH(ID_EXAMPLE)(
+PARTITION p0 DATA DIRECTORY = '/not/existent/p0Data',
+PARTITION p1 DATA DIRECTORY = '/not/existent/p1Data',
+PARTITION p2 DATA DIRECTORY = '/not/existent/p2Data',
+PARTITION p3 DATA DIRECTORY = '/not/existent/p3Data'
+);
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
index 6ed3abab46a..bc4231d1d71 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -10,6 +10,51 @@ drop table if exists t1, t2;
--enable_warnings
#
+# BUG 33429: Succeeds in adding partition when maxvalue on last partition
+#
+create table t1 (a int)
+partition by range (a)
+( partition p0 values less than (maxvalue));
+--error ER_PARTITION_MAXVALUE_ERROR
+alter table t1 add partition (partition p1 values less than (100000));
+show create table t1;
+drop table t1;
+
+# BUG 32943:
+# Locking problems in relation to partitioning and triggers
+# Also fixes and test cases of generic lock issues with
+# partition change code.
+#
+create table t1 (a integer)
+partition by range (a)
+( partition p0 values less than (4),
+ partition p1 values less than (100));
+
+delimiter |;
+create trigger tr1 before insert on t1
+for each row begin
+ set @a = 1;
+end|
+
+delimiter ;|
+alter table t1 drop partition p0;
+
+drop table t1;
+
+create table t1 (a integer)
+partition by range (a)
+( partition p0 values less than (4),
+ partition p1 values less than (100));
+LOCK TABLES t1 WRITE;
+alter table t1 drop partition p0;
+alter table t1 reorganize partition p1 into
+( partition p0 values less than (4),
+ partition p1 values less than (100));
+alter table t1 add partition ( partition p2 values less than (200));
+UNLOCK TABLES;
+drop table t1;
+
+#
# BUG 18198: Various tests for partition functions
#
#create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test
index 0ca60c14c6c..e36e335c0dd 100644
--- a/mysql-test/t/partition_symlink.test
+++ b/mysql-test/t/partition_symlink.test
@@ -2,7 +2,9 @@
# (DATA/INDEX DIR requires symlinks)
-- source include/have_partition.inc
-- source include/have_symlink.inc
-# remove the not_windows line after fixing bug#30459
+# remove the not_windows line after fixing bug#33687
+# symlinks must also work for files, not only directories
+# as in --skip-symbolic-links
-- source include/not_windows.inc
-- disable_warnings
DROP TABLE IF EXISTS t1;
@@ -24,6 +26,7 @@ DROP DATABASE IF EXISTS mysqltest2;
# files, but not the other way around (any db-user can use any
# directory or file that the mysqld-process can use, via DATA/INDEX DIR)
# this is the security flaw that was used in bug#32091 and bug#32111
+
-- echo # Creating two non colliding tables mysqltest2.t1 and test.t1
-- echo # test.t1 have partitions in mysqltest2-directory!
-- echo # user root:
@@ -35,22 +38,21 @@ DROP DATABASE IF EXISTS mysqltest2;
connect(con1,localhost,mysqltest_1,,);
-- echo # user mysqltest_1:
USE test;
-let $MYSQLD_DATADIR= `select @@datadir`;
- --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+ -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
- INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2',
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLD_DATADIR/test'
- INDEX DIRECTORY '$MYSQLD_DATADIR/test',
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
PARTITION p2 VALUES IN (2)
);
-- echo # without the patch for bug#32091 this would create
-- echo # files mysqltest2/t1.MYD + .MYI and possible overwrite
-- echo # the mysqltest2.t1 table (depending on bug#32111)
- --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+ -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
ALTER TABLE t1 REMOVE PARTITIONING;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
@@ -75,43 +77,43 @@ connection default;
# So it is using/blocking 2 files in (in 2 different directories
-- echo # test that symlinks can not overwrite files when CREATE TABLE
-- echo # user root:
+
CREATE DATABASE mysqltest2;
USE mysqltest2;
- --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+ -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
- INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2',
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLD_DATADIR/test'
- INDEX DIRECTORY '$MYSQLD_DATADIR/test'
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
);
connection con1;
-- echo # user mysqltest_1:
USE test;
- --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+ -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- error 1,1
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
- INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2',
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLD_DATADIR/test'
- INDEX DIRECTORY '$MYSQLD_DATADIR/test'
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
);
-
- --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+ -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- error 1,1
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLD_DATADIR/test'
- INDEX DIRECTORY '$MYSQLD_DATADIR/test',
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
- INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
+ DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
+ INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
);
connection default;
-- echo # user root (cleanup):
@@ -120,4 +122,49 @@ connection default;
DROP USER mysqltest_1@localhost;
disconnect con1;
+#
+# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
+#
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval create table t2 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory="$MYSQLTEST_VARDIR/tmp"
+ index directory="$MYSQLTEST_VARDIR/tmp"
+);
+
+set @org_mode=@@sql_mode;
+set @@sql_mode='NO_DIR_IN_CREATE';
+select @@sql_mode;
+create table t1 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory='/not/existing'
+ index directory='/not/existing'
+);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show create table t2;
+DROP TABLE t1, t2;
+set @@sql_mode=@org_mode;
+
+#
+# Bug 21350: Data Directory problems
+#
+-- error ER_WRONG_TABLE_NAME
+create table t1 (a int)
+partition by key (a)
+(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
+
+#
+# Insert a test that manages to create the first partition and fails with
+# the second, ensure that we clean up afterwards in a proper manner.
+#
+--error ER_WRONG_TABLE_NAME
+create table t1 (a int)
+partition by key (a)
+(partition p0,
+ partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
diff --git a/mysql-test/t/partition_windows.test b/mysql-test/t/partition_windows.test
index a0723feac44..d42a7383c99 100644
--- a/mysql-test/t/partition_windows.test
+++ b/mysql-test/t/partition_windows.test
@@ -7,23 +7,34 @@
#
# Bug 25141: Crash Server on Partitioning command
#
+# Bug#30459: Partitioning across disks failing on Windows
+# updated this test, since symlinked files are not supported on Windows
+# (not the same as symlinked directories that have a special hack
+# on windows). This test is not dependent on have_symlink.
--disable_warnings
-DROP TABLE IF EXISTS `example`;
+DROP TABLE IF EXISTS t1;
--enable_warnings
---disable_abort_on_error
-CREATE TABLE `example` (
- `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `DESCRIPTION` varchar(30) NOT NULL,
- `LEVEL` smallint(5) unsigned DEFAULT NULL,
- PRIMARY KEY (`ID_EXAMPLE`)
+CREATE TABLE t1 (
+ c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
+ c2 varchar(30) NOT NULL,
+ c3 smallint(5) unsigned DEFAULT NULL,
+ PRIMARY KEY (c1)
) ENGINE = MYISAM
-PARTITION BY HASH(ID_EXAMPLE)(
-PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data',
-PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data',
-PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data',
-PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data'
+PARTITION BY HASH(c1)(
+ PARTITION p0
+ DATA DIRECTORY = 'C:/mysqltest/p0Data'
+ INDEX DIRECTORY = 'D:/mysqltest/p0Index',
+ PARTITION p1,
+ PARTITION p2
+ DATA DIRECTORY = 'E:/mysqltest/p2Data'
+ INDEX DIRECTORY = 'F:/mysqltest/p2Index'
);
---enable_abort_on_error
+INSERT INTO t1 VALUES (NULL, "first", 1);
+INSERT INTO t1 VALUES (NULL, "second", 2);
+INSERT INTO t1 VALUES (NULL, "third", 3);
+ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
+INSERT INTO t1 VALUES (NULL, "last", 4);
+DROP TABLE t1;
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index d8d6d069676..0635a58a4a6 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -39,3 +39,38 @@ SET GLOBAL example_enum_var= e2;
SET GLOBAL example_enum_var= impossible;
UNINSTALL PLUGIN example;
+
+
+
+#
+# Bug #32757 hang with sql_mode set when setting some global variables
+#
+INSTALL PLUGIN example SONAME 'ha_example.so';
+
+select @@session.sql_mode into @old_sql_mode;
+
+# first, try normal sql_mode (no error, send OK)
+set session sql_mode='';
+set global example_ulong_var=500;
+select @@global.example_ulong_var;
+# overflow -- correct value, but throw warning
+set global example_ulong_var=1111;
+select @@global.example_ulong_var;
+
+# now, try STRICT (error occurrs, no message is sent, so send default)
+set session sql_mode='STRICT_ALL_TABLES';
+set global example_ulong_var=500;
+select @@global.example_ulong_var;
+# overflow -- throw warning, do NOT change value
+--error ER_WRONG_VALUE_FOR_VAR
+set global example_ulong_var=1111;
+select @@global.example_ulong_var;
+
+set session sql_mode=@old_sql_mode;
+
+# finally, show that conditions that already raised an error are not
+# adversely affected (error was already sent, do nothing)
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session old=bla;
+
+UNINSTALL PLUGIN example;
diff --git a/mysql-test/t/plugin_load-master.opt b/mysql-test/t/plugin_load-master.opt
new file mode 100644
index 00000000000..66637841f16
--- /dev/null
+++ b/mysql-test/t/plugin_load-master.opt
@@ -0,0 +1,3 @@
+$EXAMPLE_PLUGIN_OPT
+"--plugin-load=;EXAMPLE=ha_example.so;"
+--loose-plugin-example-enum-var=e2
diff --git a/mysql-test/t/plugin_load.test b/mysql-test/t/plugin_load.test
new file mode 100644
index 00000000000..8555247dd71
--- /dev/null
+++ b/mysql-test/t/plugin_load.test
@@ -0,0 +1,3 @@
+--source include/have_example_plugin.inc
+
+SELECT @@global.example_enum_var = 'e2';
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index bbd8783554d..74cc97538aa 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -1251,6 +1251,15 @@ disconnect user2;
disconnect user3;
#
+--echo #
+--echo # Bug#25132 disabled query cache: Qcache_free_blocks = 1
+--echo #
+set global query_cache_size=100000;
+set global query_cache_size=0;
+set global query_cache_type=0;
+show status like 'Qcache_free_blocks';
+
+--echo Restore default values.
# Bug #28211 RENAME DATABASE and query cache don't play nicely together
#
# TODO: enable these tests when RENAME DATABASE is implemented.
@@ -1298,6 +1307,25 @@ set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
+#
+# Bug#33756 - query cache with concurrent_insert=0 appears broken
+#
+FLUSH STATUS;
+SET GLOBAL query_cache_size=10*1024*1024;
+SET @save_concurrent_insert= @@concurrent_insert;
+SET GLOBAL concurrent_insert= 0;
+CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 (c1) VALUES (1), (2);
+#
+SHOW GLOBAL VARIABLES LIKE 'concurrent_insert';
+SHOW STATUS LIKE 'Qcache_hits';
+SELECT * FROM t1;
+SELECT * FROM t1;
+SHOW STATUS LIKE 'Qcache_hits';
+DROP TABLE t1;
+SET GLOBAL concurrent_insert= @save_concurrent_insert;
+SET GLOBAL query_cache_size= default;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index e20f0370e2c..e1411e7fd46 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -955,6 +955,69 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '
drop table t1;
+#
+# Bug #33833: different or-ed predicates were erroneously merged into one that
+# resulted in ref access instead of range access and a wrong result set
+#
+
+CREATE TABLE t1 (
+ a varchar(32), index (a)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
+
+INSERT INTO t1 VALUES
+ ('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
+
+SELECT a FROM t1 WHERE a='b' OR a='B';
+EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
+
+DROP TABLE t1;
+
+#
+# Bug #34731: highest possible value for INT erroneously filtered by WHERE
+#
+
+# test UNSIGNED. only occurs when indexed.
+CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1));
+
+INSERT INTO t1 VALUES (127),(254),(0),(1),(255);
+
+# test upper bound
+# count 5
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256;
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0;
+# count 4
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255;
+
+# show we don't fiddle with lower bound on UNSIGNED
+# count 0
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1;
+# count 5
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1;
+
+DROP TABLE t1;
+
+
+# test signed. only occurs when index.
+CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1));
+
+INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127);
+
+# test upper bound
+# count 5
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128;
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0;
+# count 4
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127;
+
+# test lower bound
+# count 5
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129;
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0;
+# count 4
+SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128;
+
+DROP TABLE t1;
+
# End of 5.0 tests
# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 20d044306a6..1601f7afd0e 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
SELECT @x;
DROP TABLE t1;
+
+#
+# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*):
+# Assertion `0' failed
+#
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1);
+
+SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
+SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index bc0e4ae307f..30abb797e83 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3661,6 +3661,35 @@ DROP TABLE t1;
--echo
+###########################################################################
+
+#
+# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion
+#
+
+CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
+INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
+SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
+DROP TABLE t1;
+
+#
+# Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan"
+#
+
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT, c INT, KEY(a));
+
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
+ (2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
+ (3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
+ (4, 1), (4, 2), (4, 3), (4, 4), (4, 5);
+
+FLUSH STATUS;
+SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
+SHOW STATUS LIKE 'Handler_read%';
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
index 84f0201c808..247c84fda39 100644
--- a/mysql-test/t/sp-code.test
+++ b/mysql-test/t/sp-code.test
@@ -598,6 +598,38 @@ show procedure code proc_33618_c;
drop procedure proc_33618_h;
drop procedure proc_33618_c;
+#
+# Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
+# instructions)
+#
+
+--disable_warnings
+drop procedure if exists p_20906_a;
+drop procedure if exists p_20906_b;
+--enable_warnings
+
+create procedure p_20906_a() SET @a=@a+1, @b=@b+1;
+show procedure code p_20906_a;
+
+set @a=1;
+set @b=1;
+
+call p_20906_a();
+select @a, @b;
+
+create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1;
+show procedure code p_20906_b;
+
+set @a=1;
+set @b=1;
+set @c=1;
+
+call p_20906_b();
+select @a, @b, @c;
+
+drop procedure p_20906_a;
+drop procedure p_20906_b;
+
--echo End of 5.0 tests.
#
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 23bce3805af..6896a1ab832 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2387,6 +2387,32 @@ call p1();
drop procedure p1;
#
+# Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal)
+#
+
+--disable_warnings
+drop procedure if exists proc_8759;
+--enable_warnings
+
+delimiter $$;
+
+--error ER_SP_BAD_SQLSTATE
+create procedure proc_8759()
+begin
+ declare should_be_illegal condition for sqlstate '00000';
+ declare continue handler for should_be_illegal set @x=0;
+end$$
+
+--error ER_SP_BAD_SQLSTATE
+create procedure proc_8759()
+begin
+ declare continue handler for sqlstate '00000' set @x=0;
+end$$
+
+delimiter ;$$
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index d0422ee106e..464530bec00 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -7977,6 +7977,25 @@ call proc_33618(20);
drop table t_33618;
drop procedure proc_33618;
+--echo #
+--echo # Bug#30787: Stored function ignores user defined alias.
+--echo #
+use test;
+--disable_warnings
+drop function if exists func30787;
+--enable_warnings
+create table t1(f1 int);
+insert into t1 values(1),(2);
+delimiter |;
+create function func30787(p1 int) returns int
+begin
+ return p1;
+end |
+delimiter ;|
+select (select func30787(f1)) as ttt from t1;
+drop function func30787;
+drop table t1;
+
###########################################################################
--echo # ------------------------------------------------------------------
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 4e298b2076a..16ebb710f25 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -1,7 +1,9 @@
# Can't test with embedded server
-- source include/not_embedded.inc
+# Disable concurrent inserts to avoid test failures
+set @old_concurrent_insert= @@global.concurrent_insert;
+set @@global.concurrent_insert= 0;
---sleep 2
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
@@ -39,10 +41,14 @@ create procedure bug4902_2()
begin
show processlist;
end|
---replace_column 1 # 6 # 3 localhost
+--disable_result_log
call bug4902_2()|
---replace_column 1 # 6 # 3 localhost
+--enable_result_log
+show warnings|
+--disable_result_log
call bug4902_2()|
+--enable_result_log
+show warnings|
drop procedure bug4902_2|
#
@@ -268,69 +274,72 @@ drop procedure 15298_1;
drop procedure 15298_2;
#
-# Test case disabled due to Bug#34891: sp_notembedded.test fails sporadically.
+# Bug#29936 Stored Procedure DML ignores low_priority_updates setting
#
-# #
-# # Bug#29936 Stored Procedure DML ignores low_priority_updates setting
-# #
-#
-# --disable_warnings
-# drop table if exists t1;
-# drop procedure if exists p1;
-# --enable_warnings
-#
-# create table t1 (value varchar(15));
-# create procedure p1() update t1 set value='updated' where value='old';
-#
-# # load the procedure into sp cache and execute once
-# call p1();
-#
-# insert into t1 (value) values ("old");
-#
-# connect (rl_holder, localhost, root,,);
-# connect (rl_acquirer, localhost, root,,);
-# connect (rl_contender, localhost, root,,);
-# connect (rl_wait, localhost, root,,);
-#
-# connection rl_holder;
-# select get_lock('b26162',120);
-#
-# connection rl_acquirer;
-# --send select 'rl_acquirer', value from t1 where get_lock('b26162',120);
-#
-# # we must wait till this select opens and locks the tables
-# connection rl_wait;
-# let $wait_condition=
-# select count(*) = 1 from information_schema.processlist
-# where state = "User lock" and
-# info = "select 'rl_acquirer', value from t1 where get_lock('b26162',120)";
-# --source include/wait_condition.inc
-#
-# connection default;
-# set session low_priority_updates=on;
-# --send call p1();
-#
-# connection rl_wait;
-# let $wait_condition=
-# select count(*) = 1 from information_schema.processlist
-# where state = "Locked" and
-# info = "update t1 set value='updated' where value='old'";
-# --source include/wait_condition.inc
-#
-# connection rl_contender;
-# select 'rl_contender', value from t1;
-#
-# connection rl_holder;
-# select release_lock('b26162');
+
+--disable_warnings
+drop table if exists t1;
+drop procedure if exists p1;
+--enable_warnings
+
+create table t1 (value varchar(15));
+create procedure p1() update t1 set value='updated' where value='old';
+
+# load the procedure into sp cache and execute once
+call p1();
+
+insert into t1 (value) values ("old");
+
+connect (rl_holder, localhost, root,,);
+connect (rl_acquirer, localhost, root,,);
+connect (rl_contender, localhost, root,,);
+connect (rl_wait, localhost, root,,);
+
+connection rl_holder;
+select get_lock('b26162',120);
+
+connection rl_acquirer;
+--send select 'rl_acquirer', value from t1 where get_lock('b26162',120);
+
+# we must wait till this select opens and locks the tables
+connection rl_wait;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "User lock" and
+ info = "select 'rl_acquirer', value from t1 where get_lock('b26162',120)";
+--source include/wait_condition.inc
+
+connection default;
+set session low_priority_updates=on;
+--send call p1();
+
+connection rl_wait;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Locked" and
+ info = "update t1 set value='updated' where value='old'";
+--source include/wait_condition.inc
+
+connection rl_contender;
+select 'rl_contender', value from t1;
+
+connection rl_holder;
+select release_lock('b26162');
+
+connection rl_acquirer;
+--reap
+connection default;
+--reap
+
+disconnect rl_holder;
+disconnect rl_acquirer;
+disconnect rl_wait;
+drop procedure p1;
+drop table t1;
+set session low_priority_updates=default;
+
#
-# connection rl_acquirer;
-# --reap
-# connection default;
-# --reap
+# Restore global concurrent_insert value. Keep in the end of the test file.
#
-# disconnect rl_holder;
-# disconnect rl_acquirer;
-# disconnect rl_wait;
-# drop procedure p1;
-# drop table t1;
-# set session low_priority_updates=default;
+
+set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index 7a9036c8621..acc9cc7979e 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -279,3 +279,32 @@ select concat('x',b,'x') from t1;
drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
+
+
+#
+# Bug #32753: PAD_CHAR_TO_FULL_LENGTH is not documented and interferes
+# with grant tables
+#
+
+create user mysqltest_32753@localhost;
+
+# try to make the user-table space-padded
+--connection default
+set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
+set session sql_mode='PAD_CHAR_TO_FULL_LENGTH';
+flush privileges;
+
+# if user-table is affected by PAD_CHAR_TO_FULL_LENGTH, our connect will fail
+# --error 1045
+connect (user_32753,localhost,mysqltest_32753,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
+select current_user();
+
+# clean up
+--connection default
+set session sql_mode=@OLD_SQL_MODE;
+flush privileges;
+
+--disconnect user_32753
+
+--connection default
+drop user mysqltest_32753@localhost;
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 2b71bf1093c..486f7ce7897 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -822,7 +822,6 @@ INSERT INTO t1 (col2) VALUES (-1.1E-3);
INSERT INTO t1 (col1) VALUES ('+1.8E+309');
--error 1264
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
---error 1264
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
--error 1365
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index 2f844c9cc21..cfbde8c29cd 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -586,6 +586,23 @@ SELECT a FROM t1 WHERE a NOT IN (65,66);
SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
-DROP TABLE t1;
+DROP TABLE t1, t2;
+
+#
+# Bug #34763: item_subselect.cc:1235:Item_in_subselect::row_value_transformer:
+# Assertion failed, unexpected error message:
+# ERROR 1247 (42S22): Reference '<list ref>' not supported (forward
+# reference in item list)
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES(1);
+
+CREATE TABLE t2 (placeholder CHAR(11));
+INSERT INTO t2 VALUES("placeholder");
+
+SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a;
+SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
+
+DROP TABLE t1, t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/subselect_notembedded.test b/mysql-test/t/subselect_notembedded.test
index 040c90452b9..2f1cc261f56 100644
--- a/mysql-test/t/subselect_notembedded.test
+++ b/mysql-test/t/subselect_notembedded.test
@@ -14,92 +14,44 @@ purge master logs before adddate(current_timestamp(), interval -4 day);
create table t1(a int,b int,key(a),key(b));
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
(6,7),(7,4),(5,3);
-# test for the stack overflow bug
-select sum(a),a from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1
- )group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1)
-group by a;
---replace_regex /overrun.*$/overrun detected/
---error 1436
-select sum(a),a from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1)
-group by a;
-# test for the memory consumption & subquery slowness bug
-explain select sum(a),a from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1
- )group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1)
-group by a;
---replace_regex /overrun.*$/overrun detected/
---error 1436
-explain select sum(a),a from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1 where a> ( select sum(a) from t1 where a> (
- select sum(a) from t1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1
- )group by b limit 1)group by b limit 1)group by b limit 1)
-group by a;
-drop table t1;
+let $nesting= 26;
+let $should_work_nesting= 5;
+let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
+let $end= )group by a ;
+let $start_app= where a> ( select sum(a) from t1 ;
+let $end_pre= )group by b limit 1 ;
+
+--disable_result_log
+--disable_query_log
+# At least 4 level nesting should work without errors
+while ($should_work_nesting)
+{
+--echo $should_work_nesting
+ eval $start $end;
+ eval explain $start $end;
+ let $start= $start
+ $start_app;
+ let $end= $end_pre
+ $end;
+ dec $should_work_nesting;
+}
+# Other may fail with the 'stack overrun error'
+while ($nesting)
+{
+--echo $nesting
+--error 0,1436
+ eval $start $end;
+--error 0,1436
+ eval explain $start $end;
+ let $start= $start
+ $start_app;
+ let $end= $end_pre
+ $end;
+ dec $nesting;
+}
+--enable_result_log
+--enable_query_log
+drop table t1;
+--echo End of 5.1 tests
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index 69b1b3cdb4e..7de9f6c6de0 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -38,9 +38,8 @@ drop table t2;
# We use t9 here to not crash with tables generated by the backup test
#
-disable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval 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";
-enable_query_log;
insert into t9 select * from t1;
check table t9;
@@ -66,7 +65,6 @@ drop table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SHOW CREATE TABLE t9;
-disable_query_log;
--error 1103,1103
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
@@ -81,13 +79,14 @@ create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, p
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";
# Should fail becasue the file t9.MYI already exist in 'run'
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1,1,1105
eval 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";
# Should fail becasue the file t9.MYD already exist in 'tmp'
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1,1
eval 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";
-enable_query_log;
# Check moving table t9 from default database to mysqltest;
# In this case the symlinks should be removed.
@@ -103,50 +102,40 @@ drop database mysqltest;
#
create table t1 (a int not null) engine=myisam;
-disable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
-enable_query_log;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
alter table t1 add b int;
-disable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval alter table t1 data directory="$MYSQLTEST_VARDIR/log";
-enable_query_log;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
-disable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval alter table t1 index directory="$MYSQLTEST_VARDIR/log";
-enable_query_log;
show create table t1;
drop table t1;
#
# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
#
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--write_file $MYSQLTEST_VARDIR/tmp/t1.MYI
+EOF
+
+--replace_result $MYSQLTEST_VARDIR TEST_DIR $MYSQLTEST_VARDIR TEST_DIR
+--error 1,1
eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLD_DATADIR/mysql'
-INDEX DIRECTORY='$MYSQLD_DATADIR/mysql';
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
+DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+eval CREATE TABLE t2(a INT)
+DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
--error 1
-RENAME TABLE t1 TO user;
-DROP TABLE t1;
-
-#
-# Test specifying DATA DIRECTORY that is the same as what would normally
-# have been chosen. (Bug #8707)
-#
-disable_query_log;
-eval create table t1 (i int) data directory = "$MYSQLD_DATADIR/test/";
-enable_query_log;
-show create table t1;
-drop table t1;
-disable_query_log;
-eval create table t1 (i int) index directory = "$MYSQLD_DATADIR/test/";
-enable_query_log;
-show create table t1;
-drop table t1;
+RENAME TABLE t2 TO t1;
+DROP TABLE t2;
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI
#
# Bug#8706 - temporary table with data directory option fails
@@ -155,18 +144,16 @@ connect (session1,localhost,root,,);
connect (session2,localhost,root,,);
connection session1;
-disable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a;
-enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
connection session2;
-disable_query_log;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a;
-enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -190,40 +177,51 @@ drop table t1;
#
# Bug #29325: create table overwrites .MYD file of other table (datadir)
#
-
-CREATE DATABASE db1;
-CREATE DATABASE db2;
-
-USE db2;
---disable_query_log
-eval CREATE TABLE t1 (b INT) ENGINE MYISAM
-DATA DIRECTORY = '$MYSQLD_DATADIR/db1/';
---enable_query_log
-
-INSERT INTO db2.t1 VALUES (1);
-SELECT * FROM db2.t1;
-RESET QUERY CACHE;
-
-USE db1;
-
-#no warning from create table
SET SESSION keep_files_on_create = TRUE;
+--write_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
+EOF
--disable_abort_on_error
---error 1,1
+--error 1,1,ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (a INT) ENGINE MYISAM;
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
--enable_abort_on_error
+SET SESSION keep_files_on_create = FALSE;
+CREATE TABLE t1 (a INT) ENGINE MYISAM;
+DROP TABLE t1;
-CREATE TABLE t3 (a INT) Engine=MyISAM;
-INSERT INTO t3 VALUES (1),(2),(3);
-TRUNCATE TABLE t3;
-SELECT * from t3;
-
-SET SESSION keep_files_on_create = DEFAULT;
-
-DROP TABLE db2.t1, db1.t3;
-DROP DATABASE db1;
-DROP DATABASE db2;
-USE test;
+--echo End of 5.0 tests
+#
+# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
+#
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error 1210
+eval CREATE TABLE t1(a INT)
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error 1210
+eval CREATE TABLE t1(a INT)
+DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test';
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error 1210
+eval CREATE TABLE t1(a INT)
+DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/';
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error 1210
+eval CREATE TABLE t1(a INT)
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data';
+--replace_result $MYSQLTEST_VARDIR TEST_DIR
+--error 1
+eval CREATE TABLE t1(a INT)
+INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';
+# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
+# silently ignored
+#
+SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
+DROP TABLE t1;
+SET @@SQL_MODE=@OLD_SQL_MODE;
---echo End of 5.0 tests
+--echo End of 5.1 tests
diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test
index 95533903b45..5ac93f09ac1 100644
--- a/mysql-test/t/tablelock.test
+++ b/mysql-test/t/tablelock.test
@@ -49,3 +49,16 @@ drop table t2,t1;
unlock tables;
# End of 4.1 tests
+
+#
+# Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
+#
+create temporary table t1(f1 int);
+lock tables t1 write;
+insert into t1 values (1);
+show columns from t1;
+insert into t1 values(2);
+drop table t1;
+unlock tables;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index d1ad7ab8ffa..4ab8a982e63 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -191,3 +191,17 @@ truncate t1;
insert into t1 values (42);
select * from t1;
drop table t1;
+
+#
+# Bug #35392: Delete all statement does not execute properly after
+# few delete statements
+#
+CREATE TEMPORARY TABLE t1(a INT, b VARCHAR(20));
+INSERT INTO t1 VALUES(1, 'val1'), (2, 'val2'), (3, 'val3');
+DELETE FROM t1 WHERE a=1;
+SELECT count(*) FROM t1;
+DELETE FROM t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/trigger-trans.test b/mysql-test/t/trigger-trans.test
index 8103a1ba0b1..5db5b982773 100644
--- a/mysql-test/t/trigger-trans.test
+++ b/mysql-test/t/trigger-trans.test
@@ -128,5 +128,37 @@ drop table t1, t2, t3;
disconnect connection_update;
disconnect connection_aux;
+#
+# Bug#34643: TRUNCATE crash if trigger and foreign key.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb;
+CREATE TABLE t2(b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=innodb;
+
+INSERT INTO t1 VALUES (1);
+
+CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW SET @a = 1;
+CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1;
+
+SET @a = 0;
+SET @b = 0;
+
+TRUNCATE t1;
+
+SELECT @a, @b;
+
+INSERT INTO t1 VALUES (1);
+
+DELETE FROM t1;
+
+SELECT @a, @b;
+
+DROP TABLE t2, t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index b1c816f3371..e98555e137b 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -56,3 +56,23 @@ set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
show create table t1;
drop table t1;
+
+#
+# Bug#15409: Columns with SET datatype with 64-element sets
+# may not be updated with integers
+#
+
+let $i=64;
+let $s='$i';
+dec $i;
+while ($i) {
+ let $s='$i',$s;
+ dec $i;
+}
+--eval CREATE TABLE t1(c set($s))
+INSERT INTO t1 VALUES(7);
+INSERT INTO t1 VALUES(9223372036854775808);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index eb6472ce305..68a9fc3aabb 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3384,7 +3384,6 @@ SELECT profile.person_id AS person_id
INSERT INTO t1 VALUES
(6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'),
(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
-
INSERT INTO t2 VALUES
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
@@ -3468,6 +3467,40 @@ set @@sql_mode=@old_mode;
drop view v1;
drop table t1;
+#
+# Bug #33389: Selecting from a view into a table from within SP or trigger
+# crashes server
+#
+
+create table t1 (a int, key(a));
+create table t2 (c int);
+
+create view v1 as select a b from t1;
+create view v2 as select 1 a from t2, v1 where c in
+ (select 1 from t1 where b = a);
+
+insert into t1 values (1), (1);
+insert into t2 values (1), (1);
+
+prepare stmt from "select * from v2 where a = 1";
+execute stmt;
+
+drop view v1, v2;
+drop table t1, t2;
+
+#
+# Bug #33049: Assert while running test-as3ap test(mysql-bench suite)
+#
+
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q;
+
+INSERT INTO t1 VALUES (1), (1);
+SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
###########################################################################
--echo # -----------------------------------------------------------------
@@ -3501,6 +3534,29 @@ DROP TABLE t1;
###########################################################################
--echo # -----------------------------------------------------------------
+--echo # -- Bug#35193: VIEW query is rewritten without "FROM DUAL",
+--echo # -- causing syntax error
+--echo # -----------------------------------------------------------------
+--echo
+
+CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;
+
+--echo
+
+SELECT * FROM v1;
+SHOW CREATE TABLE v1;
+
+--echo
+
+DROP VIEW v1;
+
+--echo
+--echo # -- End of test case for Bug#35193.
+--echo
+
+###########################################################################
+
+--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index 038223fd29f..4074317f38a 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -193,4 +193,37 @@ DROP PROCEDURE sp1;
DROP PROCEDURE sp2;
DROP PROCEDURE sp3;
+
+#
+# Bug#30059: End-space truncation warnings are inconsistent or incorrect
+#
+
+create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
+create table t2 (c_tinyblob tinyblob); # not affected by bug, for regression testing
+set @c = repeat(' ', 256);
+set @q = repeat('q', 256);
+
+set sql_mode = '';
+
+insert into t1 values(@c, @c, @c);
+insert into t2 values(@c);
+insert into t1 values(@q, @q, @q);
+insert into t2 values(@q);
+
+set sql_mode = 'traditional';
+
+insert into t1 values(@c, @c, @c);
+--error 1406
+insert into t2 values(@c);
+--error 1406
+insert into t1 values(@q, NULL, NULL);
+--error 1406
+insert into t1 values(NULL, @q, NULL);
+--error 1406
+insert into t1 values(NULL, NULL, @q);
+--error 1406
+insert into t2 values(@q);
+
+drop table t1, t2;
+
--echo End of 5.0 tests