summaryrefslogtreecommitdiff
path: root/mysql-test/suite/versioning
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-11-01 10:33:44 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-11-01 10:33:44 +0100
commitebf2121529fcf06971b4c0fc28f40654ef8dd99f (patch)
tree420ddcc5b2aeae06a75224062e85ee8b1ffce504 /mysql-test/suite/versioning
parent4b87d3628acf815836c0efc84fbcd878517d9b89 (diff)
parente0421b7cc8969edefca25c9a47e24f7e77c4bdf6 (diff)
downloadmariadb-git-ebf2121529fcf06971b4c0fc28f40654ef8dd99f.tar.gz
Merge branch '10.8' into 10.9
Diffstat (limited to 'mysql-test/suite/versioning')
-rw-r--r--mysql-test/suite/versioning/r/data.result2
-rw-r--r--mysql-test/suite/versioning/r/misc.result27
-rw-r--r--mysql-test/suite/versioning/r/partition.result102
-rw-r--r--mysql-test/suite/versioning/t/data.test2
-rw-r--r--mysql-test/suite/versioning/t/misc.test20
-rw-r--r--mysql-test/suite/versioning/t/partition.test75
6 files changed, 226 insertions, 2 deletions
diff --git a/mysql-test/suite/versioning/r/data.result b/mysql-test/suite/versioning/r/data.result
index 88ba4156afe..7fea6c3d06e 100644
--- a/mysql-test/suite/versioning/r/data.result
+++ b/mysql-test/suite/versioning/r/data.result
@@ -55,5 +55,5 @@ INSERT INTO `t1` VALUES
(2),
(3);
#MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
-mysqldump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc'
+mariadb-dump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc'
drop tables t1;
diff --git a/mysql-test/suite/versioning/r/misc.result b/mysql-test/suite/versioning/r/misc.result
new file mode 100644
index 00000000000..398e3b8be70
--- /dev/null
+++ b/mysql-test/suite/versioning/r/misc.result
@@ -0,0 +1,27 @@
+set time_zone='+00:00';
+#
+# MDEV-29750 triggers can modify history
+#
+set sql_mode='', timestamp=unix_timestamp('2010-10-10 10:10:10');
+create table t (a int, b int as (a+1), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
+insert into t values (1,1, '2022-01-01','2023-01-01'),(2,2, '2022-02-02','2023-02-02');
+Warnings:
+Warning 1906 The value specified for generated column 'b' in table 't' has been ignored
+Warning 1906 The value specified for generated column 's' in table 't' has been ignored
+Warning 1906 The value specified for generated column 'e' in table 't' has been ignored
+Warning 1906 The value specified for generated column 'b' in table 't' has been ignored
+Warning 1906 The value specified for generated column 's' in table 't' has been ignored
+Warning 1906 The value specified for generated column 'e' in table 't' has been ignored
+create trigger tr before insert on t for each row set new.b=1, new.s = '2022-03-03', new.e = '2023-03-03';
+insert into t (a) values (3),(4);
+select * from t for system_time all;
+a b s e
+1 2 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
+2 3 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
+3 4 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
+4 5 2010-10-10 10:10:10.000000 2038-01-19 03:14:07.999999
+drop table t;
+set sql_mode=default, timestamp=default;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 34659b2923e..4ced0c4991c 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -1579,6 +1579,108 @@ create trigger tr before insert on t for each row update tcount set c = c + 1;
insert into t select * from t;
drop table tcount, t;
#
+# MDEV-19569 Assertion `table_list->table' failed in find_field_in_table_ref and Assertion `table_ref->table || table_ref->view' in Field_iterator_table_ref::set_field_iterator
+#
+set timestamp=unix_timestamp('2000-01-01 00:00:00');
+create table t1 (i int);
+create table t2 (i int);
+alter table t1 partition by system_time
+interval (select i from t2) day (partition p1 history, partition pn current);
+ERROR 42000: INTERVAL does not support subqueries or stored functions
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time
+interval (select i from t2) day (partition p1 history, partition pn current);
+ERROR 42000: INTERVAL does not support subqueries or stored functions
+create table t1 (id int) with system versioning
+partition by system_time
+interval "hello" day (partition p1 history, partition pn current);
+ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'INTERVAL'
+create table t1 (id int) with system versioning
+partition by system_time
+interval 3.893 day (partition p1 history, partition pn current);
+drop table t1, t2;
+create table t1 (id int) with system versioning
+partition by system_time interval "3-11" year_month (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '3-11' YEAR_MONTH STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "3 11" day_hour (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '3 11' DAY_HOUR STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "3 11:12" day_minute (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '3 11:12' DAY_MINUTE STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "3 11:12:13" day_second (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '3 11:12:13' DAY_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "11:12" hour_minute (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '11:12' HOUR_MINUTE STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "11:12:13" hour_second (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '11:12:13' HOUR_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "12:13" minute_second (partition p1 history, partition pn current);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL '12:13' MINUTE_SECOND STARTS TIMESTAMP'2000-01-01 00:00:00'
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+drop table t1;
+create table t1 (id int) with system versioning
+partition by system_time interval "12:13.123" minute_microsecond (partition p1 history, partition pn current);
+ERROR HY000: Wrong parameters for partitioned `t1`: wrong value for 'INTERVAL'
+#
# End of 10.3 tests
#
#
diff --git a/mysql-test/suite/versioning/t/data.test b/mysql-test/suite/versioning/t/data.test
index 4046ec609dd..ddae6633337 100644
--- a/mysql-test/suite/versioning/t/data.test
+++ b/mysql-test/suite/versioning/t/data.test
@@ -23,7 +23,7 @@ set timestamp=default;
--exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1
## Forged query protection
--echo #MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
---replace_result mysqldump.exe mysqldump
+--replace_result mariadb-dump.exe mariadb-dump
--error 1
--exec $MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1
diff --git a/mysql-test/suite/versioning/t/misc.test b/mysql-test/suite/versioning/t/misc.test
new file mode 100644
index 00000000000..dce1e0deced
--- /dev/null
+++ b/mysql-test/suite/versioning/t/misc.test
@@ -0,0 +1,20 @@
+#
+# simple tests that don't need to be run in multiple various combinations
+#
+set time_zone='+00:00';
+
+--echo #
+--echo # MDEV-29750 triggers can modify history
+--echo #
+set sql_mode='', timestamp=unix_timestamp('2010-10-10 10:10:10');
+create table t (a int, b int as (a+1), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
+insert into t values (1,1, '2022-01-01','2023-01-01'),(2,2, '2022-02-02','2023-02-02');
+create trigger tr before insert on t for each row set new.b=1, new.s = '2022-03-03', new.e = '2023-03-03';
+insert into t (a) values (3),(4);
+select * from t for system_time all;
+drop table t;
+set sql_mode=default, timestamp=default;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index 74e806f7d5f..decf470926f 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -1402,6 +1402,81 @@ insert into t select * from t;
drop table tcount, t;
--echo #
+--echo # MDEV-19569 Assertion `table_list->table' failed in find_field_in_table_ref and Assertion `table_ref->table || table_ref->view' in Field_iterator_table_ref::set_field_iterator
+--echo #
+set timestamp=unix_timestamp('2000-01-01 00:00:00');
+create table t1 (i int);
+create table t2 (i int);
+
+--error ER_SUBQUERIES_NOT_SUPPORTED
+alter table t1 partition by system_time
+ interval (select i from t2) day (partition p1 history, partition pn current);
+
+drop table t1;
+
+--error ER_SUBQUERIES_NOT_SUPPORTED
+create table t1 (id int) with system versioning
+ partition by system_time
+ interval (select i from t2) day (partition p1 history, partition pn current);
+
+--error ER_PART_WRONG_VALUE
+create table t1 (id int) with system versioning
+ partition by system_time
+ interval "hello" day (partition p1 history, partition pn current);
+
+create table t1 (id int) with system versioning
+ partition by system_time
+ interval 3.893 day (partition p1 history, partition pn current);
+
+drop table t1, t2;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "3-11" year_month (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "3 11" day_hour (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "3 11:12" day_minute (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "3 11:12:13" day_second (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "11:12" hour_minute (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "11:12:13" hour_second (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+create table t1 (id int) with system versioning
+ partition by system_time interval "12:13" minute_second (partition p1 history, partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop table t1;
+
+--error ER_PART_WRONG_VALUE
+create table t1 (id int) with system versioning
+ partition by system_time interval "12:13.123" minute_microsecond (partition p1 history, partition pn current);
+
+--echo #
--echo # End of 10.3 tests
--echo #