summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-04-21 10:04:04 +0200
committerSergei Golubchik <serg@mariadb.org>2022-04-21 10:05:50 +0200
commit6f6c74b0d18d5d4fa8a112a6793653ef5242726d (patch)
tree0410c1f500341283233dbb9cb39511aab9baf123 /mysql-test/main
parent4730314a70119ae5857edffe2d1bec86960ef22b (diff)
parent5ba77222e9fe7af8ff403816b5338b18b342053c (diff)
downloadmariadb-git-6f6c74b0d18d5d4fa8a112a6793653ef5242726d.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/check_constraint.result60
-rw-r--r--mysql-test/main/check_constraint.test43
-rw-r--r--mysql-test/main/default.result9
-rw-r--r--mysql-test/main/default.test9
-rw-r--r--mysql-test/main/default_innodb.result18
-rw-r--r--mysql-test/main/default_innodb.test22
-rw-r--r--mysql-test/main/func_default.result43
-rw-r--r--mysql-test/main/func_default.test27
-rw-r--r--mysql-test/main/plugin.result9
-rw-r--r--mysql-test/main/plugin.test17
10 files changed, 257 insertions, 0 deletions
diff --git a/mysql-test/main/check_constraint.result b/mysql-test/main/check_constraint.result
index 3511af84166..89c16fabfa2 100644
--- a/mysql-test/main/check_constraint.result
+++ b/mysql-test/main/check_constraint.result
@@ -235,3 +235,63 @@ a b
insert t1 (b) values (1);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
+#
+# MDEV-25638 Assertion `!result' failed in convert_const_to_int
+#
+create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x111'
+select * from t1;
+v1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x111'
+select v1 from t1;
+v1
+select * from t1;
+v1
+prepare stmt from "select * from t1";
+execute stmt;
+v1
+execute stmt;
+v1
+flush tables;
+select * from t1;
+v1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x111'
+select * from t1;
+v1
+deallocate prepare stmt;
+drop table t1;
+#
+# MDEV-26061 MariaDB server crash at Field::set_default
+#
+create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+insert ignore into t1 values ( 'x' , 'x' ) ;
+Warnings:
+Warning 1265 Data truncated for column 'v2' at row 1
+Warning 1265 Data truncated for column 'v1' at row 1
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+drop table t1;
+#
+# End of 10.2 tests
+#
+#
+# MDEV-26061 MariaDB server crash at Field::set_default
+#
+create table t1 (d timestamp check (default (d) is true)) as select 1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() CHECK (default(`d`) is true),
+ `1` int(1) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/check_constraint.test b/mysql-test/main/check_constraint.test
index 93538fd1666..20d359f469b 100644
--- a/mysql-test/main/check_constraint.test
+++ b/mysql-test/main/check_constraint.test
@@ -176,3 +176,46 @@ select * from t1 where a is null;
--error ER_CONSTRAINT_FAILED
insert t1 (b) values (1);
drop table t1;
+
+--echo #
+--echo # MDEV-25638 Assertion `!result' failed in convert_const_to_int
+--echo #
+
+--enable_prepare_warnings
+create table t1 (v1 bigint check (v1 not in ('x' , 'x111'))) ;
+select * from t1;
+select v1 from t1;
+select * from t1;
+prepare stmt from "select * from t1";
+execute stmt;
+execute stmt;
+flush tables;
+select * from t1;
+select * from t1;
+deallocate prepare stmt;
+drop table t1;
+--disable_prepare_warnings
+
+--echo #
+--echo # MDEV-26061 MariaDB server crash at Field::set_default
+--echo #
+
+create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x')));
+insert ignore into t1 values ( 'x' , 'x' ) ;
+drop table t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-26061 MariaDB server crash at Field::set_default
+--echo #
+
+create table t1 (d timestamp check (default (d) is true)) as select 1;
+show create table t1;
+drop table t1;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result
index 59685380406..0082f595b07 100644
--- a/mysql-test/main/default.result
+++ b/mysql-test/main/default.result
@@ -3397,6 +3397,15 @@ ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
show warnings;
Level Code Message
Error 4029 Expression for field `a` is referring to uninitialized field `a`
+#
+# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+#
+CREATE TABLE t1 (pk varchar(36) DEFAULT uuid());
+INSERT INTO t1 VALUES (),();
+SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
+1
+1
+DROP TABLE t1;
# end of 10.2 test
#
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
diff --git a/mysql-test/main/default.test b/mysql-test/main/default.test
index bcd6ef7a9fb..c495c597fe5 100644
--- a/mysql-test/main/default.test
+++ b/mysql-test/main/default.test
@@ -2116,6 +2116,15 @@ DROP TABLE t1;
create table t1 (a int as (a));
show warnings;
+
+--echo #
+--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+--echo #
+
+CREATE TABLE t1 (pk varchar(36) DEFAULT uuid());
+INSERT INTO t1 VALUES (),();
+SELECT 1 FROM t1 GROUP BY DEFAULT(pk);
+DROP TABLE t1;
--echo # end of 10.2 test
--echo #
diff --git a/mysql-test/main/default_innodb.result b/mysql-test/main/default_innodb.result
new file mode 100644
index 00000000000..81e9672df24
--- /dev/null
+++ b/mysql-test/main/default_innodb.result
@@ -0,0 +1,18 @@
+#
+# MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+#
+CREATE TABLE v0 (
+v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) ,
+v1 DATETIME NULL ) engine=innodb;
+SHOW DATABASES LIKE 'x';
+Database (x)
+SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0;
+v2 v1 DEFAULT ( v2 )
+DROP TABLE v0;
+CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb;
+SELECT DISTINCT DEFAULT(v2) FROM t1 ;
+DEFAULT(v2)
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/default_innodb.test b/mysql-test/main/default_innodb.test
new file mode 100644
index 00000000000..2fc74950845
--- /dev/null
+++ b/mysql-test/main/default_innodb.test
@@ -0,0 +1,22 @@
+
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-26423: MariaDB server crash in Create_tmp_table::finalize
+--echo #
+
+CREATE TABLE v0 (
+ v2 DATE DEFAULT ( v1 MOD 68321183.000000 ) ,
+ v1 DATETIME NULL ) engine=innodb;
+SHOW DATABASES LIKE 'x';
+SELECT DISTINCT v2 , v1 , DEFAULT ( v2 ) FROM v0;
+DROP TABLE v0;
+
+CREATE TABLE t1 (v1 DATE, v2 DATE DEFAULT(v1)) engine=innodb;
+SELECT DISTINCT DEFAULT(v2) FROM t1 ;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result
index 8721270ca1c..2b5c869ee66 100644
--- a/mysql-test/main/func_default.result
+++ b/mysql-test/main/func_default.result
@@ -159,5 +159,48 @@ a
10
DROP TABLE t1;
#
+# MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
+#
+create table t1 (a datetime default current_timestamp);
+insert into t1 () values (),();
+create algorithm=temptable view v1 as select * from t1;
+create algorithm=merge view v2 as select * from t1;
+select default(a) = now() from v1;
+default(a) = now()
+NULL
+NULL
+select default(a) = now() from v2;
+default(a) = now()
+1
+1
+select table_name,is_updatable from information_schema.views;
+table_name is_updatable
+v1 NO
+v2 YES
+drop view v1, v2;
+drop table t1;
+create table t1 (v1 timestamp) select 'x';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `v1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `x` varchar(1) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select default(v1) from (select v1 from t1) dt;
+default(v1)
+2001-01-01 10:20:30
+select default(v1) from (select v1 from t1 group by v1) dt;
+default(v1)
+0000-00-00 00:00:00
+drop table t1;
+create table t1 (a text default '');
+create algorithm=temptable view v1 as select * from t1;
+insert into t1 values ('a');
+select default(a) from v1;
+default(a)
+NULL
+drop view v1;
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test
index cba7842c68f..daa99f1f459 100644
--- a/mysql-test/main/func_default.test
+++ b/mysql-test/main/func_default.test
@@ -140,5 +140,32 @@ SELECT a FROM t1 WHERE CASE WHEN a THEN DEFAULT(a) END IS FALSE;
DROP TABLE t1;
--echo #
+--echo # MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
+--echo #
+create table t1 (a datetime default current_timestamp);
+insert into t1 () values (),();
+create algorithm=temptable view v1 as select * from t1;
+create algorithm=merge view v2 as select * from t1;
+select default(a) = now() from v1;
+select default(a) = now() from v2;
+--sorted_result
+select table_name,is_updatable from information_schema.views;
+drop view v1, v2;
+drop table t1;
+
+create table t1 (v1 timestamp) select 'x';
+show create table t1;
+select default(v1) from (select v1 from t1) dt;
+select default(v1) from (select v1 from t1 group by v1) dt;
+drop table t1;
+
+create table t1 (a text default '');
+create algorithm=temptable view v1 as select * from t1;
+insert into t1 values ('a');
+select default(a) from v1;
+drop view v1;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result
index c1e7739be37..47df1f4653b 100644
--- a/mysql-test/main/plugin.result
+++ b/mysql-test/main/plugin.result
@@ -357,4 +357,13 @@ select * from mysql.plugin WHERE name='unexisting_plugin';
name dl
UNINSTALL PLUGIN unexisting_plugin;
ERROR 42000: PLUGIN unexisting_plugin does not exist
+#
+# MDEV-26323 use-after-poison issue of MariaDB server
+#
+INSTALL PLUGIN DEALLOCATE SONAME '';
+ERROR HY000: Can't open shared library '.so'
+INSTALL PLUGIN DEALLOCATE SONAME 'x';
+ERROR HY000: Can't open shared library 'x.so'
+INSTALL PLUGIN DEALLOCATE SONAME 'xx';
+ERROR HY000: Can't open shared library 'xx.so'
# End of 10.2 tests
diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test
index 61b5f9b87c6..d3e0fa1edda 100644
--- a/mysql-test/main/plugin.test
+++ b/mysql-test/main/plugin.test
@@ -296,4 +296,21 @@ select * from mysql.plugin WHERE name='unexisting_plugin';
--error ER_SP_DOES_NOT_EXIST
UNINSTALL PLUGIN unexisting_plugin;
+--echo #
+--echo # MDEV-26323 use-after-poison issue of MariaDB server
+--echo #
+
+--replace_regex /library '.*[\\/].(dll|so)' [(].*[)]/library '.so'/
+--error ER_CANT_OPEN_LIBRARY
+INSTALL PLUGIN DEALLOCATE SONAME '';
+
+--replace_regex /library '.*[\\/]x.(dll|so)' [(].*[)]/library 'x.so'/
+--error ER_CANT_OPEN_LIBRARY
+INSTALL PLUGIN DEALLOCATE SONAME 'x';
+
+--replace_regex /library '.*[\\/]xx.(dll|so)' [(].*[)]/library 'xx.so'/
+--error ER_CANT_OPEN_LIBRARY
+INSTALL PLUGIN DEALLOCATE SONAME 'xx';
+
+
--echo # End of 10.2 tests