summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorSergei Petrunia <sergey@mariadb.com>2022-04-26 15:18:15 +0300
committerSergei Petrunia <sergey@mariadb.com>2022-04-26 15:18:15 +0300
commit2d18943a63ba51657c0e8ff0d4c98b16786a81b0 (patch)
tree8a74a5f20839ad2378caf6bc794a6813ab6fc5e3 /mysql-test/t
parentc01ee954bf3b10fef85af7b8c77d319ff7bd6b61 (diff)
parent9b2d36660bbb4f93c6b9e0761c91d57d47f59196 (diff)
downloadmariadb-git-bb-10.2-mdev26047.tar.gz
Merge branch '10.2' of github.com:MariaDB/server into 10.2bb-10.2-mdev26047-v2bb-10.2-mdev26047
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/create_select.test (renamed from mysql-test/t/create_select_tmp.test)47
-rw-r--r--mysql-test/t/derived_view.test52
-rw-r--r--mysql-test/t/func_default.test11
-rw-r--r--mysql-test/t/information_schema_tables.test5
-rw-r--r--mysql-test/t/mysql_tzinfo_to_sql_symlink.test17
-rw-r--r--mysql-test/t/parser.test24
-rw-r--r--mysql-test/t/parser_not_embedded.test15
7 files changed, 154 insertions, 17 deletions
diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select.test
index ef3315aed97..170bbba31d4 100644
--- a/mysql-test/t/create_select_tmp.test
+++ b/mysql-test/t/create_select.test
@@ -1,39 +1,52 @@
-# Testcase for BUG#4551
+# This does not work for RBR yet.
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed_or_statement.inc
+
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+
+--echo #
+--echo # Testcase for BUG#4551
+--echo #
+
# The bug was that when the table was TEMPORARY, it was not deleted if
# the CREATE SELECT failed (the code intended too, but it actually
# didn't). And as the CREATE TEMPORARY TABLE was not written to the
# binlog if it was a transactional table, it resulted in an
# inconsistency between binlog and the internal list of temp tables.
-# This does not work for RBR yet.
---source include/have_binlog_format_mixed_or_statement.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
--- source include/have_innodb.inc
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error ER_DUP_ENTRY
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
---error 1146
+--error ER_NO_SUCH_TABLE
select * from t2;
drop table t1;
-# End of 4.1 tests
+--echo #
+--echo # End of 4.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write
+--echo #
+create table t1 (a int, b text not null default '');
+alter table t1 character set = utf8;
+create table t2 select * from t1;
+insert into t1 values (1,'');
+drop table t1, t2;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 0f3d9b224ba..f36401271cc 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -2376,4 +2376,56 @@ DROP PROCEDURE p1;
DROP VIEW v1,v2,v3;
DROP TABLE t1;
+--echo #
+--echo # MDEV-27212: 2-nd execution of PS for select with embedded derived tables
+--echo # and correlated subquery in select list of outer derived
+--echo #
+create table t1 ( id int, id2 int ) engine=myisam;
+create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam;
+insert into t1 values (3, 2), (4, 2), (3, 4);
+insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1);
+
+let $q=
+select id from t1
+ join
+ ( select dt2.x1,
+ ( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
+ from ( select x1 from t2 u where x3 = 1 ) dt2
+ ) dt
+ on t1.id = dt.x1
+where t1.id2 < dt.m;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval create procedure sp1() $q;
+call sp1();
+call sp1();
+
+create view v2 as select x1 from t2 u where x3 = 1;
+create view v as
+select v2.x1,
+ ( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2;
+
+let $q=
+select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m;
+
+eval prepare stmt from "$q";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+eval create procedure sp2() $q;
+call sp2();
+call sp2();
+
+drop procedure sp1;
+drop procedure sp2;
+
+drop view v, v2;
+
+drop table t1,t2;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/func_default.test b/mysql-test/t/func_default.test
index f542a279478..53cd94e58c4 100644
--- a/mysql-test/t/func_default.test
+++ b/mysql-test/t/func_default.test
@@ -166,5 +166,16 @@ drop view v1;
drop table t1;
--echo #
+--echo # MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
+--echo #
+create table t (a blob default 'x');
+create view v as select * from t;
+insert into t () values ();
+update t set a = default;
+query_vertical select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
+drop view v;
+drop table t;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/information_schema_tables.test b/mysql-test/t/information_schema_tables.test
index ebb1e21a65b..bc4f269a3fb 100644
--- a/mysql-test/t/information_schema_tables.test
+++ b/mysql-test/t/information_schema_tables.test
@@ -24,9 +24,14 @@ LOOP
END LOOP $
--delimiter ;
--connection default
+# Avoid "Prepared statement needs to be re-prepared"
+# Note, the code could probably eventually fixed to avoid forcing re-pepare if
+# the *temporary* instance of Sp_caches (not the permanent one) was invalidated.
+--disable_ps_protocol
--disable_warnings
SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1;
--enable_warnings
+--enable_ps_protocol
# Cleanup
--replace_result $conid CONID
--eval KILL $conid
diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
index 8ca82b87e30..fcb5916c4a2 100644
--- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
@@ -32,6 +32,23 @@
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
+--echo #
+--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+--echo #
+
+--echo #
+--echo # Testing --skip-write-binlog
+--echo #
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
+
+--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
#
# Cleanup
#
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index efb936d8ea4..095d274724b 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -1409,5 +1409,29 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp;
DROP TABLE scientific_notation;
--echo #
+--echo # MDEV-6899 extra semicolon in show create event syntax
+--echo #
+set timestamp=unix_timestamp('2020-10-10 5:5:5');
+create table t1 (a int);
+delimiter $;
+create trigger a before insert on t1 for each row set @a:=1;select 2$
+delimiter ;$
+query_vertical show create trigger a;
+drop table t1;
+
+delimiter $;
+create procedure a() select 1;select 2$
+delimiter ;$
+query_vertical show create procedure a;
+drop procedure a;
+
+delimiter $;
+create function a() returns int return 1;select 2$
+delimiter ;$
+query_vertical show create function a;
+drop function a;
+set timestamp=default;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/parser_not_embedded.test b/mysql-test/t/parser_not_embedded.test
index 3af1260f4ad..270573ece93 100644
--- a/mysql-test/t/parser_not_embedded.test
+++ b/mysql-test/t/parser_not_embedded.test
@@ -99,3 +99,18 @@ ROLLBACK AND NO CHAIN NO RELEASE;
--echo #
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # MDEV-6899 extra semicolon in show create event syntax
+--echo #
+set timestamp=unix_timestamp('2020-10-10 5:5:5');
+delimiter $;
+create event a on schedule every 1 day do set @a:=1;select 2$
+delimiter ;$
+query_vertical show create event a;
+drop event a;
+set timestamp=default;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #