summaryrefslogtreecommitdiff
path: root/mysql-test/suite/period
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 12:49:19 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 12:49:19 +0200
commit09a1f0075a8d5752dd7b2940a20d86a040af1741 (patch)
tree42c96cf95d5df2950b77329c76c0024f33088aff /mysql-test/suite/period
parente6f95b23f425001a14a528256354e0faf4e272f6 (diff)
parent440d4b282dd4992d64abdd6289859598db7e5f75 (diff)
downloadmariadb-git-09a1f0075a8d5752dd7b2940a20d86a040af1741.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'mysql-test/suite/period')
-rw-r--r--mysql-test/suite/period/r/delete.result21
-rw-r--r--mysql-test/suite/period/r/overlaps.result32
-rw-r--r--mysql-test/suite/period/r/update.result26
-rw-r--r--mysql-test/suite/period/t/delete.test31
-rw-r--r--mysql-test/suite/period/t/overlaps.test43
-rw-r--r--mysql-test/suite/period/t/update.test32
6 files changed, 183 insertions, 2 deletions
diff --git a/mysql-test/suite/period/r/delete.result b/mysql-test/suite/period/r/delete.result
index 75723d17c09..d8dae7b2a99 100644
--- a/mysql-test/suite/period/r/delete.result
+++ b/mysql-test/suite/period/r/delete.result
@@ -372,7 +372,28 @@ drop procedure sp;
drop table t,t2,t3,log_tbl;
drop view v;
drop procedure log;
+# MDEV-19130 Assertion
+# `next_insert_id >= auto_inc_interval_for_cur_row.minimum()'
+# failed in handler::update_auto_increment after error 167
+create or replace table t (f tinyint auto_increment null,
+s timestamp, e timestamp,
+period for app(s,e), key(f, s));
+insert into t (s,e) values
+('2021-08-22 10:28:43', '2023-09-17 00:00:00'),
+('2019-05-09 21:45:24', '2020-04-22 14:38:49');
+insert into t (s,e) select s,e from t;
+insert into t (s,e) select s,e from t;
+insert into t (s,e) select s,e from t;
+insert into t (s,e) values ('2015-07-07 00:00:00','2020-03-11 08:48:52');
+insert into t (s,e) select s,e from t;
+insert into t (s,e) select s,e from t;
+insert into t select * from t;
+ERROR 22003: Out of range value for column 'f' at row ROW
+delete ignore from t
+for portion of app from '2015-07-07 00:00:00' to '2020-03-11 08:48:52';
+drop table t;
create table t1 (pk int, s date, e date, period for se (s,e), primary key (pk,se without overlaps));
insert into t1 values (1,'2020-01-01','2020-02-20');
delete from t1 for portion of se from '2020-01-30' to '2020-01-31';
drop table t1;
+# End of 10.5 tests
diff --git a/mysql-test/suite/period/r/overlaps.result b/mysql-test/suite/period/r/overlaps.result
index fcd54a0a942..b8f23ce413c 100644
--- a/mysql-test/suite/period/r/overlaps.result
+++ b/mysql-test/suite/period/r/overlaps.result
@@ -127,7 +127,7 @@ ERROR HY000: Period `p` is not found in table
create or replace table t(id int, s date, e date,
period for p(s,e),
primary key(id, s, p without overlaps));
-ERROR HY000: Key `(null)` cannot explicitly include column `s`
+ERROR HY000: Key `PRIMARY` cannot explicitly include column `s`
create or replace table t(id int, s date, e date,
period for p(s,e),
primary key(id));
@@ -320,4 +320,34 @@ t1 CREATE TABLE `t1` (
PARTITION `pn` CURRENT ENGINE = InnoDB)
insert into t1 values (1,'2013-01-12','2015-11-04'),
(2,'2016-03-15','2024-11-09');
+# MDEV-22714 Assertion `index->table->is_instant()' failed upon
+# multi-update on table with WITHOUT OVERLAPS
+create or replace table t (a int);
+insert into t values (0),(null),(0);
+create or replace table t1 (f int, s date, e date, period for p(s,e),
+unique(f, p without overlaps));
+insert into t1 values (0,'2026-02-12','2036-09-16'),
+(null,'2025-03-09','2032-12-05');
+update ignore t join t1 set f = a;
+# MDEV-22639 Assertion `inited != NONE' failed in
+# handler::ha_check_overlaps upon multi-table update
+create or replace table t (f int, s date, e date, period for p(s,e),
+unique(f, p without overlaps)) engine=myisam;
+insert into t values (1,'1988-08-25','2024-03-06');
+create or replace table t1 (a int) engine=myisam;
+insert into t1 values (1),(2);
+update t join t1 set s = '2020-01-01';
+# MDEV-22608 ASAN use-after-poison in TABLE::check_period_overlaps
+create or replace table t1 (s date, e date, b bit, period for p(s,e),
+unique(b, p without overlaps)) engine=myisam;
+insert into t1 values ('2024-12-21','2034-06-29',0),
+('2024-12-21','2034-06-29',1);
+update t1 set b = 1;
+ERROR 23000: Duplicate entry '\x01-2034-06-29-2024-12-21' for key 'b'
+# MDEV-22677 Server crashes in ha_partition::open upon update on
+# partitioned HEAP table with WITHOUT OVERLAPS
+create or replace table t (id int, s date, e date, period for p(s,e),
+primary key(id, p without overlaps)
+) engine=heap partition by hash(id);
+update t set id = 1;
drop table t, t1;
diff --git a/mysql-test/suite/period/r/update.result b/mysql-test/suite/period/r/update.result
index 05d1a2eb6d3..f726b4c07cf 100644
--- a/mysql-test/suite/period/r/update.result
+++ b/mysql-test/suite/period/r/update.result
@@ -281,3 +281,29 @@ create table t1 (s date, e date, period for app(s,e), f varchar(8)) engine=aria
insert into t1 values ('2024-05-13','2026-03-25','foo');
update t1 for portion of app from '2024-04-02' to '2026-03-15' set f = 'bar';
drop table t1;
+# MDEV-19130 Assertion
+# `next_insert_id >= auto_inc_interval_for_cur_row.minimum()'
+# failed in handler::update_auto_increment after error 167
+create table t1 (id int auto_increment, f int, s datetime, e datetime, period for p(s,e), primary key(id));
+insert into t1 (s,e) values ('1994-01-06','2004-11-30'),('1994-06-21','1997-06-20');
+update ignore t1 set id = 2429681664;
+Warnings:
+Warning 1264 Out of range value for column 'id' at row 1
+Warning 1264 Out of range value for column 'id' at row 2
+update ignore t1 for portion of p from '1995-07-06' to '2009-01-12' set f = 1;
+drop table t1;
+#
+# MDEV-22805 SIGSEGV in check_fields on UPDATE (optimized builds) | Assertion `thd->lex->sql_command == SQLCOM_UPDATE' failed.
+#
+CREATE TABLE t1 (a INT, b DATE, c DATE, PERIOD FOR APPTIME(b, c));
+INSERT INTO t1 VALUES(1, '1999-01-01', '2018-12-12');
+UPDATE t1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
+ERROR 42000: This version of MariaDB doesn't yet support 'updating and querying the same temporal periods table'
+set @tmp= "UPDATE t1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100";
+execute immediate @tmp;
+ERROR 42000: This version of MariaDB doesn't yet support 'updating and querying the same temporal periods table'
+CREATE VIEW v1 AS SELECT * FROM t1;
+UPDATE v1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
+ERROR 42S02: 'v1' is a view
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/period/t/delete.test b/mysql-test/suite/period/t/delete.test
index e7c6aabb0aa..3750e064ab9 100644
--- a/mysql-test/suite/period/t/delete.test
+++ b/mysql-test/suite/period/t/delete.test
@@ -199,11 +199,38 @@ call sp;
drop table t1;
drop procedure sp;
-
drop table t,t2,t3,log_tbl;
drop view v;
drop procedure log;
+--echo # MDEV-19130 Assertion
+--echo # `next_insert_id >= auto_inc_interval_for_cur_row.minimum()'
+--echo # failed in handler::update_auto_increment after error 167
+
+create or replace table t (f tinyint auto_increment null,
+ s timestamp, e timestamp,
+ period for app(s,e), key(f, s));
+insert into t (s,e) values
+ ('2021-08-22 10:28:43', '2023-09-17 00:00:00'),
+ ('2019-05-09 21:45:24', '2020-04-22 14:38:49');
+insert into t (s,e) select s,e from t;
+insert into t (s,e) select s,e from t;
+insert into t (s,e) select s,e from t;
+insert into t (s,e) values ('2015-07-07 00:00:00','2020-03-11 08:48:52');
+insert into t (s,e) select s,e from t;
+insert into t (s,e) select s,e from t;
+
+--replace_regex /row \d+/row ROW/
+--error HA_ERR_AUTOINC_ERANGE
+insert into t select * from t;
+
+--disable_warnings
+delete ignore from t
+ for portion of app from '2015-07-07 00:00:00' to '2020-03-11 08:48:52';
+--enable_warnings
+
+drop table t;
+
#
# MDEV-22424 Server crashes in handler::check_duplicate_long_entry_key or Assertion `inited == NONE || lookup_handler != this' failed upon DELETE FOR PORTION on table with long unique key
#
@@ -211,3 +238,5 @@ create table t1 (pk int, s date, e date, period for se (s,e), primary key (pk,s
insert into t1 values (1,'2020-01-01','2020-02-20');
delete from t1 for portion of se from '2020-01-30' to '2020-01-31';
drop table t1;
+
+--echo # End of 10.5 tests
diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test
index 30032f9898c..6cd78769d4a 100644
--- a/mysql-test/suite/period/t/overlaps.test
+++ b/mysql-test/suite/period/t/overlaps.test
@@ -299,5 +299,48 @@ insert into t1 values (1,'2013-01-12','2015-11-04'),
(2,'2016-03-15','2024-11-09');
+--echo # MDEV-22714 Assertion `index->table->is_instant()' failed upon
+--echo # multi-update on table with WITHOUT OVERLAPS
+
+create or replace table t (a int);
+insert into t values (0),(null),(0);
+
+create or replace table t1 (f int, s date, e date, period for p(s,e),
+ unique(f, p without overlaps));
+
+insert into t1 values (0,'2026-02-12','2036-09-16'),
+ (null,'2025-03-09','2032-12-05');
+
+update ignore t join t1 set f = a;
+
+--echo # MDEV-22639 Assertion `inited != NONE' failed in
+--echo # handler::ha_check_overlaps upon multi-table update
+
+create or replace table t (f int, s date, e date, period for p(s,e),
+ unique(f, p without overlaps)) engine=myisam;
+insert into t values (1,'1988-08-25','2024-03-06');
+create or replace table t1 (a int) engine=myisam;
+insert into t1 values (1),(2);
+
+update t join t1 set s = '2020-01-01';
+
+
+--echo # MDEV-22608 ASAN use-after-poison in TABLE::check_period_overlaps
+
+create or replace table t1 (s date, e date, b bit, period for p(s,e),
+ unique(b, p without overlaps)) engine=myisam;
+insert into t1 values ('2024-12-21','2034-06-29',0),
+ ('2024-12-21','2034-06-29',1);
+--error ER_DUP_ENTRY
+update t1 set b = 1;
+
+
+--echo # MDEV-22677 Server crashes in ha_partition::open upon update on
+--echo # partitioned HEAP table with WITHOUT OVERLAPS
+
+create or replace table t (id int, s date, e date, period for p(s,e),
+ primary key(id, p without overlaps)
+ ) engine=heap partition by hash(id);
+update t set id = 1;
drop table t, t1;
diff --git a/mysql-test/suite/period/t/update.test b/mysql-test/suite/period/t/update.test
index 0f54dd80eec..3f4dd2bdc68 100644
--- a/mysql-test/suite/period/t/update.test
+++ b/mysql-test/suite/period/t/update.test
@@ -173,3 +173,35 @@ update t1 for portion of app from '2024-04-02' to '2026-03-15' set f = 'bar';
# cleanup
drop table t1;
+
+--echo # MDEV-19130 Assertion
+--echo # `next_insert_id >= auto_inc_interval_for_cur_row.minimum()'
+--echo # failed in handler::update_auto_increment after error 167
+create table t1 (id int auto_increment, f int, s datetime, e datetime, period for p(s,e), primary key(id));
+insert into t1 (s,e) values ('1994-01-06','2004-11-30'),('1994-06-21','1997-06-20');
+update ignore t1 set id = 2429681664;
+update ignore t1 for portion of p from '1995-07-06' to '2009-01-12' set f = 1;
+
+drop table t1;
+
+--echo #
+--echo # MDEV-22805 SIGSEGV in check_fields on UPDATE (optimized builds) | Assertion `thd->lex->sql_command == SQLCOM_UPDATE' failed.
+--echo #
+CREATE TABLE t1 (a INT, b DATE, c DATE, PERIOD FOR APPTIME(b, c));
+
+INSERT INTO t1 VALUES(1, '1999-01-01', '2018-12-12');
+
+# Without a patch the following statement crashs a server built in debug mode
+let $stmt= UPDATE t1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
+--error ER_NOT_SUPPORTED_YET
+eval $stmt;
+eval set @tmp= "$stmt";
+--error ER_NOT_SUPPORTED_YET
+execute immediate @tmp;
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+--error ER_IT_IS_A_VIEW
+UPDATE v1 FOR PORTION OF APPTIME FROM (SELECT '1999-01-01' FROM t1 WHERE a=2) TO '2018-01-01' SET a = 100;
+
+DROP VIEW v1;
+DROP TABLE t1;