summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-05-22 11:47:09 +0200
committerSergei Golubchik <serg@mariadb.org>2018-05-22 11:47:09 +0200
commit4ec8598c1dcb63499bce998142b8e5b8b09b2d30 (patch)
tree23010dcb3489b54b4bc9b26481a4a16a4378914a /mysql-test/main
parentfe3bf136b6cf83aac5a6e21d3db1c4e821612017 (diff)
parentafe5a51c2df95aa282e4459afeb7f037563def92 (diff)
downloadmariadb-git-4ec8598c1dcb63499bce998142b8e5b8b09b2d30.tar.gz
Merge branch 'github/10.2' into 10.3
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/create_or_replace.result20
-rw-r--r--mysql-test/main/create_or_replace.test25
-rw-r--r--mysql-test/main/cte_recursive.result30
-rw-r--r--mysql-test/main/cte_recursive.test36
-rw-r--r--mysql-test/main/explain_slowquerylog.result4
-rw-r--r--mysql-test/main/explain_slowquerylog.test6
-rw-r--r--mysql-test/main/grant.result5
-rw-r--r--mysql-test/main/grant.test8
-rw-r--r--mysql-test/main/grant_not_windows.result8
-rw-r--r--mysql-test/main/grant_not_windows.test14
-rw-r--r--mysql-test/main/insert_select.result9
-rw-r--r--mysql-test/main/insert_select.test10
-rw-r--r--mysql-test/main/mysql.test16
-rw-r--r--mysql-test/main/mysql_cp932.test42
-rw-r--r--mysql-test/main/sp.result11
-rw-r--r--mysql-test/main/sp.test15
16 files changed, 236 insertions, 23 deletions
diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result
index e26884f1cbf..0c1bccb861a 100644
--- a/mysql-test/main/create_or_replace.result
+++ b/mysql-test/main/create_or_replace.result
@@ -459,6 +459,26 @@ UNLOCK TABLES;
DROP FUNCTION f1;
DROP TABLE t1;
#
+# MDEV-11129
+# CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc()
+# references t1
+#
+CREATE OR REPLACE TABLE t1(a INT);
+CREATE FUNCTION f1() RETURNS VARCHAR(16383)
+BEGIN
+INSERT INTO t1 VALUES(1);
+RETURN 'test';
+END;
+$$
+CREATE OR REPLACE TABLE t1 AS SELECT f1();
+ERROR HY000: Table 't1' is specified twice, both as a target for 'CREATE' and as a separate source for data
+LOCK TABLE t1 WRITE;
+CREATE OR REPLACE TABLE t1 AS SELECT f1();
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+UNLOCK TABLES;
+DROP FUNCTION f1;
+DROP TABLE t1;
+#
# MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
# Locked_tables_list::unlock_locked_tables
#
diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test
index 4ef4189694b..3ae882139bc 100644
--- a/mysql-test/main/create_or_replace.test
+++ b/mysql-test/main/create_or_replace.test
@@ -398,6 +398,31 @@ DROP FUNCTION f1;
DROP TABLE t1;
--echo #
+--echo # MDEV-11129
+--echo # CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc()
+--echo # references t1
+--echo #
+
+CREATE OR REPLACE TABLE t1(a INT);
+DELIMITER $$;
+CREATE FUNCTION f1() RETURNS VARCHAR(16383)
+BEGIN
+ INSERT INTO t1 VALUES(1);
+ RETURN 'test';
+END;
+$$
+DELIMITER ;$$
+--error ER_UPDATE_TABLE_USED
+CREATE OR REPLACE TABLE t1 AS SELECT f1();
+LOCK TABLE t1 WRITE;
+--error ER_TABLE_NOT_LOCKED
+CREATE OR REPLACE TABLE t1 AS SELECT f1();
+UNLOCK TABLES;
+
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+--echo #
--echo # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
--echo # Locked_tables_list::unlock_locked_tables
--echo #
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index 19a2e964959..4d1535cacb2 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -3239,6 +3239,36 @@ Parent Child Path
654 987 987,
321 654 987,654,
DROP TABLE t1;
+#
+# MDEV-16212: recursive CTE with global ORDER BY
+#
+set statement max_recursive_iterations = 2 for
+WITH RECURSIVE qn AS (
+SELECT 1 FROM dual UNION ALL
+SELECT 1 FROM qn
+ORDER BY (SELECT * FROM qn))
+SELECT count(*) FROM qn;
+ERROR 42000: This version of MariaDB doesn't yet support 'global ORDER_BY/LIMIT in recursive CTE spec'
+#
+# MDEV-15581: mix of ALL and DISTINCT UNION in recursive CTE
+#
+create table t1(a int);
+insert into t1 values(1),(2);
+insert into t1 values(1),(2);
+set @c=0, @d=0;
+WITH RECURSIVE qn AS
+(
+select 1,0 as col from t1
+union distinct
+select 1,0 from t1
+union all
+select 3, 0*(@c:=@c+1) from qn where @c<1
+union all
+select 3, 0*(@d:=@d+1) from qn where @d<1
+)
+select * from qn;
+ERROR 42000: This version of MariaDB doesn't yet support 'mix of ALL and DISTINCT UNION operations in recursive CTE spec'
+drop table t1;
# Start of 10.3 tests
#
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index b0b38a28b34..6f394bd673c 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -2247,6 +2247,42 @@ ORDER BY Path;
DROP TABLE t1;
+--echo #
+--echo # MDEV-16212: recursive CTE with global ORDER BY
+--echo #
+
+--error ER_NOT_SUPPORTED_YET
+set statement max_recursive_iterations = 2 for
+WITH RECURSIVE qn AS (
+SELECT 1 FROM dual UNION ALL
+SELECT 1 FROM qn
+ORDER BY (SELECT * FROM qn))
+SELECT count(*) FROM qn;
+
+--echo #
+--echo # MDEV-15581: mix of ALL and DISTINCT UNION in recursive CTE
+--echo #
+
+create table t1(a int);
+insert into t1 values(1),(2);
+insert into t1 values(1),(2);
+
+set @c=0, @d=0;
+--error ER_NOT_SUPPORTED_YET
+WITH RECURSIVE qn AS
+(
+select 1,0 as col from t1
+union distinct
+select 1,0 from t1
+union all
+select 3, 0*(@c:=@c+1) from qn where @c<1
+union all
+select 3, 0*(@d:=@d+1) from qn where @d<1
+)
+select * from qn;
+
+drop table t1;
+
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/main/explain_slowquerylog.result b/mysql-test/main/explain_slowquerylog.result
index 2b350cf04ff..63da82b5288 100644
--- a/mysql-test/main/explain_slowquerylog.result
+++ b/mysql-test/main/explain_slowquerylog.result
@@ -54,3 +54,7 @@ SELECT 1;
1
SET log_slow_rate_limit=@save1;
SET long_query_time=@save2;
+create table t1 (a int);
+execute immediate "select * from t1 join t1 t2 on (t1.a>5) where exists (select 1)";
+a a
+drop table t1;
diff --git a/mysql-test/main/explain_slowquerylog.test b/mysql-test/main/explain_slowquerylog.test
index 6503a326eb8..ee90fbac4e6 100644
--- a/mysql-test/main/explain_slowquerylog.test
+++ b/mysql-test/main/explain_slowquerylog.test
@@ -61,3 +61,9 @@ SELECT 1;
SET log_slow_rate_limit=@save1;
SET long_query_time=@save2;
+#
+# MDEV-16153 Server crashes in Apc_target::disable, ASAN heap-use-after-free in Explain_query::~Explain_query upon/after EXECUTE IMMEDIATE
+#
+create table t1 (a int);
+execute immediate "select * from t1 join t1 t2 on (t1.a>5) where exists (select 1)";
+drop table t1;
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result
index 22add627144..1d4402185a5 100644
--- a/mysql-test/main/grant.result
+++ b/mysql-test/main/grant.result
@@ -1709,11 +1709,6 @@ drop user mysqluser11@localhost;
drop database mysqltest1;
End of 5.0 tests
set names utf8;
-grant select on test.* to юзер_юзер@localhost;
-user()
-юзер_юзер@localhost
-revoke all on test.* from юзер_юзер@localhost;
-drop user юзер_юзер@localhost;
grant select on test.* to очень_длинный_юзер890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890@localhost;
ERROR HY000: String 'очень_длинный_юзер890123456789012345678901234567890123' is too long for user name (should be no longer than 80)
set names default;
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index c945e818181..72e427493da 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -1510,15 +1510,7 @@ drop database mysqltest1;
--echo End of 5.0 tests
-
-#
-# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
-#
set names utf8;
-grant select on test.* to юзер_юзер@localhost;
---exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
-revoke all on test.* from юзер_юзер@localhost;
-drop user юзер_юзер@localhost;
--error ER_WRONG_STRING_LENGTH
grant select on test.* to очень_длинный_юзер890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890@localhost;
set names default;
diff --git a/mysql-test/main/grant_not_windows.result b/mysql-test/main/grant_not_windows.result
new file mode 100644
index 00000000000..fedfaf984b2
--- /dev/null
+++ b/mysql-test/main/grant_not_windows.result
@@ -0,0 +1,8 @@
+set names utf8;
+create user юзер_юзер@localhost;
+grant select on test.* to юзер_юзер@localhost;
+user()
+юзер_юзер@localhost
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+set names default;
diff --git a/mysql-test/main/grant_not_windows.test b/mysql-test/main/grant_not_windows.test
new file mode 100644
index 00000000000..55b09232edc
--- /dev/null
+++ b/mysql-test/main/grant_not_windows.test
@@ -0,0 +1,14 @@
+ # UTF8 parameters to mysql client do not work on Windows
+--source include/not_windows.inc
+--source include/not_embedded.inc
+
+#
+# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
+#
+set names utf8;
+create user юзер_юзер@localhost;
+grant select on test.* to юзер_юзер@localhost;
+--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+set names default;
diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result
index 1a3a38b1f35..5094638c92b 100644
--- a/mysql-test/main/insert_select.result
+++ b/mysql-test/main/insert_select.result
@@ -856,3 +856,12 @@ INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
DROP TABLE t1;
End of 5.1 tests
+create table t1 (i int);
+create table t2 as select value(i) as a from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` binary(0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+End of 5.5 tests
diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test
index fda89f18d99..0b5cdf95daf 100644
--- a/mysql-test/main/insert_select.test
+++ b/mysql-test/main/insert_select.test
@@ -425,3 +425,13 @@ SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
DROP TABLE t1;
--echo End of 5.1 tests
+
+#
+# MDEV-15318 CREATE .. SELECT VALUES produces invalid table structure
+#
+create table t1 (i int);
+create table t2 as select value(i) as a from t1;
+show create table t2;
+drop table t1, t2;
+
+--echo End of 5.5 tests
diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test
index 022a24ce25e..01953ba2112 100644
--- a/mysql-test/main/mysql.test
+++ b/mysql-test/main/mysql.test
@@ -53,14 +53,22 @@ drop table t1;
#
# Bug#17939 Wrong table format when using UTF8 strings
-#
---exec $MYSQL --default-character-set=utf8 --table -e "SELECT 'John Doe' as '__tañgè Ñãmé'" 2>&1
---exec $MYSQL --default-character-set=utf8 --table -e "SELECT '__tañgè Ñãmé' as 'John Doe'" 2>&1
+write_file $MYSQL_TMP_DIR/mysql_in;
+SELECT 'John Doe' as '__tañgè Ñãmé';
+SELECT '__tañgè Ñãmé' as 'John Doe';
+EOF
+--exec $MYSQL --default-character-set=utf8 --table < $MYSQL_TMP_DIR/mysql_in 2>&1
+remove_file $MYSQL_TMP_DIR/mysql_in;
#
# Bug#18265 -- mysql client: No longer right-justifies numeric columns
#
---exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;"
+write_file $MYSQL_TMP_DIR/mysql_in;
+create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;
+EOF
+--exec $MYSQL -t --default-character-set utf8 test < $MYSQL_TMP_DIR/mysql_in
+remove_file $MYSQL_TMP_DIR/mysql_in;
+
#
# "DESCRIBE" commands may return strange NULLness flags.
diff --git a/mysql-test/main/mysql_cp932.test b/mysql-test/main/mysql_cp932.test
index 60a129c3805..8fba5750d89 100644
--- a/mysql-test/main/mysql_cp932.test
+++ b/mysql-test/main/mysql_cp932.test
@@ -10,13 +10,43 @@
# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\'
#
+let $mysql_in= $MYSQL_TMP_DIR/mysql_in;
+
# new command \C or charset
---exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
---exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
+write_file $mysql_in;
+\C cp932 \g
+EOF
+--exec $MYSQL --default-character-set=utf8 test < $mysql_in
+remove_file $mysql_in;
+
+write_file $mysql_in;
+charset utf8;
+EOF
+--exec $MYSQL --default-character-set=cp932 test < $mysql_in
+remove_file $mysql_in;
# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"
+write_file $mysql_in;
+charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;
+EOF
+--exec $MYSQL --default-character-set=utf8 test < $mysql_in
+remove_file $mysql_in;
+
+write_file $mysql_in;
+charset cp932; select 'ƒ\'
+EOF
+--exec $MYSQL --default-character-set=utf8 test < $mysql_in
+remove_file $mysql_in;
+
+write_file $mysql_in;
+/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'
+EOF
+--exec $MYSQL --default-character-set=utf8 test < $mysql_in
+remove_file $mysql_in;
+
+write_file $mysql_in;
+/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'
+EOF
+--exec $MYSQL --default-character-set=utf8 test < $mysql_in
+remove_file $mysql_in;
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index f6f34318584..64caf0fd554 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -8251,6 +8251,17 @@ DROP PROCEDURE proc_13;
DROP PROCEDURE proc_select;
DROP TABLE t1, t2;
SET max_sp_recursion_depth=default;
+#
+# MDEV-15347: Valgrind or ASAN errors in mysql_make_view on query
+# from information_schema
+#
+CREATE VIEW v AS SELECT 1;
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS
+UNION
+SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS;
+DROP FUNCTION f;
+DROP VIEW v;
#End of 10.1 tests
#
# MDEV-11081: CURSOR for query with GROUP BY
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index 80d541ac77c..cfd6604acce 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -9749,6 +9749,21 @@ DROP TABLE t1, t2;
SET max_sp_recursion_depth=default;
+--echo #
+--echo # MDEV-15347: Valgrind or ASAN errors in mysql_make_view on query
+--echo # from information_schema
+--echo #
+
+CREATE VIEW v AS SELECT 1;
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+--disable_result_log
+SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS
+UNION
+SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS;
+--enable_result_log
+DROP FUNCTION f;
+DROP VIEW v;
+
--echo #End of 10.1 tests
--echo #