1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä
2022-10-25 10:04:37 +03:00
68 changed files with 1349 additions and 130 deletions

View File

@ -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
#

View File

@ -1156,6 +1156,107 @@ 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
#
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
(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
(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
(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
(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
(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
(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
(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
#
#

View File

@ -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 #

View File

@ -1089,6 +1089,80 @@ insert into t select * from t;
# cleanup
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 #
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 #