diff options
author | Daniel Fiala <df@natsys-lab.com> | 2016-06-19 07:38:28 +0100 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2017-05-05 20:35:08 +0300 |
commit | be6f2d302cd71677e1fafbeea9347c196f21e1bd (patch) | |
tree | 2814467d8c5585f852a47bef2caabea808b1c60d /mysql-test/t | |
parent | 14bdfa85416471e4ccd4aaa65397f282a2b508c3 (diff) | |
download | mariadb-git-be6f2d302cd71677e1fafbeea9347c196f21e1bd.tar.gz |
0.1: SQL-level System Versioning
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/auto_increment.test | 34 | ||||
-rw-r--r-- | mysql-test/t/create.test | 98 | ||||
-rw-r--r-- | mysql-test/t/delete.test | 44 | ||||
-rw-r--r-- | mysql-test/t/insert.test | 73 | ||||
-rw-r--r-- | mysql-test/t/insert_select.test | 65 | ||||
-rw-r--r-- | mysql-test/t/insert_update.test | 45 | ||||
-rw-r--r-- | mysql-test/t/multi_update.test | 116 | ||||
-rw-r--r-- | mysql-test/t/select.test | 110 | ||||
-rw-r--r-- | mysql-test/t/update.test | 39 | ||||
-rw-r--r-- | mysql-test/t/variables.test | 160 |
10 files changed, 586 insertions, 198 deletions
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 7f0ab5dc169..dca4b026c80 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -397,3 +397,37 @@ insert into t1 values(null); select last_insert_id(); select * from t1; drop table t1; + +--echo # +--echo # System Versioning Support +--echo # +--echo # +CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY (id)) WITH SYSTEM VERSIONING; +CREATE TABLE T1(id INT UNSIGNED AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, PRIMARY KEY (id)); +INSERT INTO t1(x, y) VALUES(1, 11); +INSERT INTO T1(x, y) VALUES(1, 11); +INSERT INTO t1(x, y) VALUES(2, 12); +INSERT INTO T1(x, y) VALUES(2, 12); +INSERT INTO t1(x, y) VALUES(3, 13); +INSERT INTO T1(x, y) VALUES(3, 13); +INSERT INTO t1(x, y) VALUES(4, 14); +INSERT INTO T1(x, y) VALUES(4, 14); +INSERT INTO t1(x, y) VALUES(5, 15); +INSERT INTO T1(x, y) VALUES(5, 15); +INSERT INTO t1(x, y) VALUES(6, 16); +INSERT INTO T1(x, y) VALUES(6, 16); +INSERT INTO t1(x, y) VALUES(7, 17); +INSERT INTO T1(x, y) VALUES(7, 17); +INSERT INTO t1(x, y) VALUES(8, 18); +INSERT INTO T1(x, y) VALUES(8, 18); +INSERT INTO t1(x, y) VALUES(9, 19); +INSERT INTO T1(x, y) VALUES(9, 19); +SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id); +DELETE FROM t1 WHERE x=2; +DELETE FROM T1 WHERE x=2; +SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id); +DELETE FROM t1 WHERE x>7; +DELETE FROM T1 WHERE x>7; +SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id); +DROP TABLE t1; +DROP TABLE T1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 6461204f06e..5e5c5008d8e 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1781,3 +1781,101 @@ create table t1; # create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j; drop table t1; + +# +# Create table SYSTEM VERSIONING +# +--echo # +--echo # Test for SYSTEM VERSIONING CREATE +--echo # + +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; +SHOW CREATE TABLE t1; + +drop table if exists t1; + +--error ER_SYS_START_MORE_THAN_ONCE +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_start2 TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; + +--error ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_END_COLUMN +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; + +--error ER_SYS_END_MORE_THAN_ONCE +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; + +--error ER_SYS_START_NOT_SPECIFIED +create table t1 ( + XNo INT UNSIGNED, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; + +--error ER_SYS_END_MORE_THAN_ONCE +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +); + +--error ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_START_COLUMN +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_insert, Sys_remove) +) WITH SYSTEM VERSIONING; + +--error ER_MISSING_WITH_SYSTEM_VERSIONING +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +); + +--error ER_SYS_START_AND_SYS_END_SAME +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_start) +); + +--error ER_SYS_START_FIELD_MUST_BE_TIMESTAMP +create table t1 ( + XNo INT UNSIGNED, + Sys_start INT GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; + +--error ER_SYS_END_FIELD_MUST_BE_TIMESTAMP +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end INT GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index c82420640c2..a91e6ddf82e 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -582,3 +582,47 @@ DELETE v2 FROM v2; DROP VIEW v2, v1; DROP TABLE t1, t2; + +# +# SQL DELETE for SYSTEM VERSIONING +# +--echo # +--echo # Test for SYSTEM VERSIONING +--echo # + +SET @@session.time_zone='+00:00'; + +create table t1 ( + XNo INT UNSIGNED, + Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, + Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end) +) WITH SYSTEM VERSIONING; + +INSERT INTO t1(XNo) VALUES(0); +INSERT INTO t1(XNo) VALUES(1); +INSERT INTO t1(XNo) VALUES(2); +INSERT INTO t1(XNo) VALUES(3); +INSERT INTO t1(XNo) VALUES(4); +INSERT INTO t1(XNo) VALUES(5); +INSERT INTO t1(XNo) VALUES(6); +INSERT INTO t1(XNo) VALUES(7); +INSERT INTO t1(XNo) VALUES(8); +INSERT INTO t1(XNo) VALUES(9); + +SELECT XNo, Sys_end < '2038-01-19 03:14:07' FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07'; +DELETE FROM t1 WHERE XNo = 0; +SELECT XNo, Sys_end < '2038-01-19 03:14:07' FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07'; +DELETE FROM t1 WHERE XNo = 1; +SELECT XNo, Sys_end < '2038-01-19 03:14:07' FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07'; +DELETE FROM t1 WHERE XNo > 5; + +CREATE VIEW vt1 AS SELECT XNo FROM t1; + +SELECT XNo FROM vt1; +DELETE FROM vt1 WHERE XNo = 3; +SELECT XNo FROM vt1; +SELECT XNo, Sys_end < '2038-01-19 03:14:07' FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07'; + +DROP VIEW vt1; +DROP TABLE t1; diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 206c5553100..7a4523a3f49 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -573,3 +573,76 @@ insert ignore into t1 values (1,12) on duplicate key update f2=13; set @@old_mode=""; insert ignore into t1 values (1,12); DROP TABLE t1; + +--echo # +--echo # System Versioning Support +--echo # +--echo # + +-- source include/have_innodb.inc + +SET @@session.time_zone='+00:00'; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING; +INSERT INTO t1(x, y) VALUES(3, 4); +INSERT INTO t1(x, y) VALUES(2, 3); +INSERT INTO t1 VALUES(40, 33); +SELECT x, y, Sys_end FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +INSERT INTO t1(x, y) VALUES(3, 4); +INSERT INTO t1(x, y) VALUES(2, 3); +INSERT INTO t1 VALUES(40, 33); +SELECT x, y, Sys_end FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY(id)) WITH SYSTEM VERSIONING; +INSERT INTO t1(x, y) VALUES(33, 44); +INSERT INTO t1(id, x, y) VALUES(20, 33, 44); +INSERT INTO t1 VALUES(40, 33, 44); +SELECT id, x, y, Sys_end FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY(id)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +INSERT INTO t1(x, y) VALUES(33, 44); +INSERT INTO t1(id, x, y) VALUES(20, 33, 44); +INSERT INTO t1 VALUES(40, 33, 44); +SELECT id, x, y, Sys_end FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING; +CREATE VIEW vt1_1 AS SELECT x, y FROM t1; +CREATE VIEW vt1_2 AS SELECT x, y, Sys_end FROM t1; +INSERT INTO t1(x, y) VALUES(8001, 9001); +--error ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER +INSERT INTO t1(x, y, Sys_end) VALUES(8001, 9001, '2015-1-1 0:0:0'); +INSERT INTO vt1_1(x, y) VALUES(1001, 2001); +INSERT INTO vt1_1 VALUES(1002, 2002); +INSERT INTO vt1_2(x, y) VALUES(3001, 4001); +--error ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER +INSERT INTO vt1_2 VALUES(3002, 4002, '2015-1-1 0:0:0'); +SELECT x, y, Sys_end FROM t1; +SELECT x, y FROM vt1_1; +SELECT x, y, Sys_end FROM vt1_2; +DROP TABLE t1; +DROP VIEW vt1_1; +DROP VIEW vt1_2; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +CREATE VIEW vt1_1 AS SELECT x, y FROM t1; +CREATE VIEW vt1_2 AS SELECT x, y, Sys_end FROM t1; +INSERT INTO t1(x, y) VALUES(8001, 9001); +--error ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER +INSERT INTO t1(x, y, Sys_end) VALUES(8001, 9001, '2015-1-1 0:0:0'); +INSERT INTO vt1_1(x, y) VALUES(1001, 2001); +INSERT INTO vt1_1 VALUES(1002, 2002); +INSERT INTO vt1_2(x, y) VALUES(3001, 4001); +--error ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER +INSERT INTO vt1_2 VALUES(3002, 4002, '2015-1-1 0:0:0'); +SELECT x, y, Sys_end FROM t1; +SELECT x, y FROM vt1_1; +SELECT x, y, Sys_end FROM vt1_2; +DROP TABLE t1; +DROP VIEW vt1_1; +DROP VIEW vt1_2; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index fda89f18d99..11dca894117 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -425,3 +425,68 @@ SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size; DROP TABLE t1; --echo End of 5.1 tests + +--echo # +--echo # System Versioning Support +--echo # +--echo # + +-- source include/have_innodb.inc + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=MyISAM; +CREATE TABLE t2(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=MyISAM; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +DELETE FROM t1 WHERE x >= 1; +INSERT INTO t1(x, y) VALUES + (1, 1001), + (2, 2001), + (3, 3001), + (4, 4001), + (5, 5001), + (6, 6001), + (7, 7001), + (8, 8001), + (9, 9001); +INSERT INTO t2 SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t1; +SELECT x, y FROM t2; +DROP TABLE t1; +DROP TABLE t2; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +CREATE TABLE t2(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +DELETE FROM t1 WHERE x >= 1; +INSERT INTO t1(x, y) VALUES + (1, 1001), + (2, 2001), + (3, 3001), + (4, 4001), + (5, 5001), + (6, 6001), + (7, 7001), + (8, 8001), + (9, 9001); +INSERT INTO t2 SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t1; +SELECT x, y FROM t2; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 7234973eeb8..518fea8d2a1 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -311,3 +311,48 @@ insert into t1(f1) values(1) on duplicate key update f1=1; select @stamp2:=f2 from t1; select if( @stamp1 = @stamp2, "correct", "wrong"); drop table t1; + +--echo # +--echo # System Versioning Support +--echo # +--echo # + +-- source include/have_innodb.inc + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY(x, y)) WITH SYSTEM VERSIONING; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +INSERT INTO t1(x, y) VALUES(3, 3000) ON DUPLICATE KEY UPDATE y = y+1; +INSERT INTO t1(x, y) VALUES(4, 4000) ON DUPLICATE KEY UPDATE y = y+1; +INSERT INTO t1(x, y) VALUES(4, 4001) ON DUPLICATE KEY UPDATE y = y+1; +INSERT INTO t1(x, y) VALUES(4, 4444) ON DUPLICATE KEY UPDATE y = y+1; +SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY(x, y)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +INSERT INTO t1(x, y) VALUES(3, 3000) ON DUPLICATE KEY UPDATE y = y+1; +INSERT INTO t1(x, y) VALUES(4, 4000) ON DUPLICATE KEY UPDATE y = y+1; +INSERT INTO t1(x, y) VALUES(4, 4001) ON DUPLICATE KEY UPDATE y = y+1; +INSERT INTO t1(x, y) VALUES(4, 4444) ON DUPLICATE KEY UPDATE y = y+1; +SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 64e61f7c0b5..a5a9ca4943e 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -984,3 +984,119 @@ deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; --echo end of 5.5 tests + + +--source include/have_xtradb.inc + +--echo +--echo # Bug mdev-5970 +--echo # Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD +--echo + +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (5, 7); +INSERT INTO t2 VALUES (6, 97); + +CREATE ALGORITHM = MERGE VIEW v1 AS +SELECT a2.f1 AS f1, a2.f2 AS f2 +FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 +WITH LOCAL CHECK OPTION; + +SELECT * FROM v1; +UPDATE v1 SET f1 = 1; +SELECT * FROM v1; + +DROP TABLE t1, t2; +DROP VIEW v1; + +--echo # +--echo # MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 +--echo # FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE +--echo # + +CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB; +INSERT INTO table_11757486 VALUES (0),(0); +SET SESSION SQL_MODE='STRICT_ALL_TABLES'; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +UPDATE IGNORE table_11757486 SET field1=128; + +--error ER_WARN_DATA_OUT_OF_RANGE +UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +--error ER_WARN_DATA_OUT_OF_RANGE +UPDATE table_11757486 SET field1=128; + +SET SESSION SQL_MODE=''; +UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1; +UPDATE IGNORE table_11757486 SET field1=128; + +DROP TABLE table_11757486; + +SET SESSION SQL_MODE=default; + +--echo end of 10.0 tests + +--echo # +--echo # System Versioning Support +--echo # +--echo # + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING; +CREATE TABLE t2(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +INSERT INTO t2(x, y) VALUES + (1, 1010), + (2, 2010), + (3, 3010), + (4, 4010), + (5, 5010), + (6, 6010), + (7, 7010), + (8, 8010), + (9, 9010); +UPDATE t1, t2 SET t1.y = t1.x + t1.y, t2.y = t2.x + t2.y WHERE t1.x > 7 AND t2.x < 7; +SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t1; +SELECT x, y FROM t2 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t2; +DROP TABLE t1; +DROP TABLE t2; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +CREATE TABLE t2(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +INSERT INTO t2(x, y) VALUES + (1, 1010), + (2, 2010), + (3, 3010), + (4, 4010), + (5, 5010), + (6, 6010), + (7, 7010), + (8, 8010), + (9, 9010); +UPDATE t1, t2 SET t1.y = t1.x + t1.y, t2.y = t2.x + t2.y WHERE t1.x > 7 AND t2.x < 7; +SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t1; +SELECT x, y FROM t2 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0'; +SELECT x, y FROM t2; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index e8d5f9fa445..3d2c689591e 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -25,13 +25,13 @@ if (`select @join_cache_level_for_select_test is not null`) } CREATE TABLE t1 ( - Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, + Period_ smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL ); INSERT INTO t1 VALUES (9410,9412); -select period from t1; +select period_ from t1; select * from t1; select t1.* from t1; @@ -1361,7 +1361,7 @@ select fld1,fld3 from t2 where fld1 like "25050_"; select distinct companynr from t2; select distinct companynr from t2 order by companynr; select distinct companynr from t2 order by companynr desc; -select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%"; +select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%"; select distinct fld3 from t2 where companynr = 34 order by fld3; select distinct fld3 from t2 limit 10; @@ -1374,26 +1374,26 @@ select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10; # make a big table. create table t3 ( - period int not null, + period_ int not null, name char(32) not null, companynr int not null, price double(11,0), price2 double(11,0), - key (period), + key (period_), key (name) ); --disable_query_log -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1003,"extramarital",37,39654943,235872); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1004,"spates",78,726498,72987523); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1005,"cloakroom",78,98439034,823742); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1006,"gazer",101,834598,27348324); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1007,"hand",154,983543950,29837423); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1008,"tucked",311,234298,3275892); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374834,9872392); -INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1003,"extramarital",37,39654943,235872); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1004,"spates",78,726498,72987523); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1005,"cloakroom",78,98439034,823742); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1006,"gazer",101,834598,27348324); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1007,"hand",154,983543950,29837423); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1008,"tucked",311,234298,3275892); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1009,"gems",447,2374834,9872392); +INSERT INTO t3 (period_,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234); --enable_query_log create temporary table tmp engine = myisam select * from t3; @@ -1462,39 +1462,39 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2 # Some test with ORDER BY and limit # -explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; +explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_; +explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10; +explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10; # # Search with a constant table. # -select period from t1; -select period from t1 where period=1900; -select fld3,period from t1,t2 where fld1 = 011401 order by period; +select period_ from t1; +select period_ from t1 where period_=1900; +select fld3,period_ from t1,t2 where fld1 = 011401 order by period_; # # Search with a constant table and several keyparts. (Rows are read only once # in the beginning of the search) # -select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001; +select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001; -explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; +explain select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period_; # # Search with a constant table and several rows from another table # -select fld3,period from t2,t1 where companynr*10 = 37*10; +select fld3,period_ from t2,t1 where companynr*10 = 37*10; # # Search with a table reference and without a key. # t3 will be the main table. # -select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price; +select fld3,period_,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period_ >= 1001 and period_ <= 1002 and t2.companynr = 37 order by fld3,period_, price; # # Search with an interval on a table with full key on reference table. @@ -1502,7 +1502,7 @@ select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1 # t2nr will be checked. # -select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37; +select t2.fld1,fld3,period_,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period_ = 1001 and t2.companynr = 37; # # We need another table for join stuff.. @@ -1594,18 +1594,18 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr= # each record # -select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; +select t2.fld1,t2.companynr,fld3,period_ from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period_ = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period_ = 1008; -select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009; +select t2.fld1,t2.companynr,fld3,period_ from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period_>=1008 and period_<=1009; -select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009; +select t2.fld1,t2.companynr,fld3,period_ from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period_>=1008 and period_<=1009; # # Test of many parenthesis levels # -select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909); -select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6))); +select period_ from t1 where (((period_ > 0) or period_ < 10000 or (period_ = 1900)) and (period_=1900 and period_ <= 1901) or (period_=1903 and (period_=1903)) and period_>=1902) or ((period_=1904 or period_=1905) or (period_=1906 or period_>1907)) or (period_=1908 and period_ = 1909); +select period_ from t1 where ((period_ > 0 and period_ < 1) or (((period_ > 0 and period_ < 100) and (period_ > 10)) or (period_ > 10)) or (period_ > 0 and (period_ > 5 or period_ > 6))); select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1; @@ -1663,7 +1663,7 @@ select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 grou # Calculation with group functions # -select sum(Period)/count(*) from t1; +select sum(Period_)/count(*) from t1; select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr; select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg; @@ -1753,13 +1753,13 @@ select max(t2nr) from t3 where price=983543950; # Test of alias # -select t1.period from t3 = t1 limit 1; -select t1.period from t1 as t1 limit 1; -select t1.period as "Nuvarande period" from t1 as t1 limit 1; -select period as ok_period from t1 limit 1; -select period as ok_period from t1 group by ok_period limit 1; +select t1.period_ from t3 = t1 limit 1; +select t1.period_ from t1 as t1 limit 1; +select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1; +select period_ as ok_period from t1 limit 1; +select period_ as ok_period from t1 group by ok_period limit 1; select 1+1 as summa from t1 group by summa limit 1; -select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1; +select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1; # # Some simple show commands @@ -4671,3 +4671,37 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined)); drop table t1; --echo End of 10.0 tests + +--echo # +--echo # System Versioning Support +--echo # +--echo # +CREATE TABLE t1( x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING; +INSERT INTO t1(x, y) VALUES + (0, 100), + (1, 101), + (2, 102), + (3, 103), + (4, 104), + (5, 105), + (6, 106), + (7, 107), + (8, 108), + (9, 109); +DELETE FROM t1 WHERE x = 3; +DELETE FROM t1 WHERE x > 7; +--real_sleep 1 +INSERT INTO t1(x, y) VALUES(3, 33); +--replace_column 1 Sys_start +SELECT @time := Sys_start FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07' WHERE x = 3 AND y = 33; +SELECT x, y FROM t1; +SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME FROM TIMESTAMP \'0-0-0 0:0:0\' TO TIMESTAMP \'', @time, '\''); +PREPARE stmt_t1 FROM @query; +EXECUTE stmt_t1; +SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP \'0-0-0 0:0:0\' AND TIMESTAMP \'', @time, '\''); +PREPARE stmt_t1 FROM @query; +EXECUTE stmt_t1; +SET @time=NULL; +SET @query=NULL; +DEALLOCATE PREPARE stmt_t1; +DROP TABLE t1; diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index e5ef0b11127..5dfc623acc8 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -654,3 +654,42 @@ show status like 'Handler_read%'; drop table t1, t2; --echo # End of MariaDB 10.0 tests + +--echo # +--echo # System Versioning Support +--echo # +--echo # + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +SELECT x, y FROM t1; +UPDATE t1 SET y = y + 1 WHERE x > 7; +SELECT x, y FROM t1; +SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07'; +DROP TABLE t1; + +CREATE TABLE t1(x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING ENGINE=InnoDB; +INSERT INTO t1(x, y) VALUES + (1, 1000), + (2, 2000), + (3, 3000), + (4, 4000), + (5, 5000), + (6, 6000), + (7, 7000), + (8, 8000), + (9, 9000); +SELECT x, y FROM t1; +UPDATE t1 SET y = y + 1 WHERE x > 7; +SELECT x, y FROM t1; +SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07'; +DROP TABLE t1; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 1ba20f0ac9e..1f65956f8ad 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1295,166 +1295,6 @@ DROP TABLE t1; --echo End of 5.1 tests -########################################################################### - ---echo ---echo # ---echo # Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes. ---echo # ---echo - ---echo # Checking sql_notes... -SET @sql_notes_saved = @@sql_notes; - ---echo -SET @@sql_notes = ON; -SELECT @@sql_notes; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET @@sql_notes = OF; -SELECT @@sql_notes; - ---echo -SET @@sql_notes = OFF; -SELECT @@sql_notes; - ---echo -SET @@sql_notes = @sql_notes_saved; - ---echo ---echo # Checking delay_key_write... -SET @delay_key_write_saved = @@delay_key_write; - ---echo -SET GLOBAL delay_key_write = ON; -SELECT @@delay_key_write; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL delay_key_write = OF; -SELECT @@delay_key_write; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL delay_key_write = AL; -SELECT @@delay_key_write; - ---echo -SET GLOBAL delay_key_write = OFF; -SELECT @@delay_key_write; - ---echo -SET GLOBAL delay_key_write = ALL; -SELECT @@delay_key_write; - ---echo -SET GLOBAL delay_key_write = @delay_key_write_saved; - ---echo ---echo # Checking sql_safe_updates... -SET @sql_safe_updates_saved = @@sql_safe_updates; - ---echo -SET @@sql_safe_updates = ON; -SELECT @@sql_safe_updates; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET @@sql_safe_updates = OF; -SELECT @@sql_safe_updates; - ---echo -SET @@sql_safe_updates = OFF; -SELECT @@sql_safe_updates; - ---echo -SET @@sql_safe_updates = @sql_safe_updates_saved; - ---echo ---echo # Checking foreign_key_checks... -SET @foreign_key_checks_saved = @@foreign_key_checks; - ---echo -SET @@foreign_key_checks = ON; -SELECT @@foreign_key_checks; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET @@foreign_key_checks = OF; -SELECT @@foreign_key_checks; - ---echo -SET @@foreign_key_checks = OFF; -SELECT @@foreign_key_checks; - ---echo -SET @@foreign_key_checks = @foreign_key_checks_saved; - ---echo ---echo # Checking unique_checks... -SET @unique_checks_saved = @@unique_checks; - ---echo -SET @@unique_checks = ON; -SELECT @@unique_checks; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET @@unique_checks = OF; -SELECT @@unique_checks; - ---echo -SET @@unique_checks = OFF; -SELECT @@unique_checks; - ---echo -SET @@unique_checks = @unique_checks_saved; - ---echo ---echo # Checking sql_buffer_result... -SET @sql_buffer_result_saved = @@sql_buffer_result; - ---echo -SET @@sql_buffer_result = ON; -SELECT @@sql_buffer_result; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET @@sql_buffer_result = OF; -SELECT @@sql_buffer_result; - ---echo -SET @@sql_buffer_result = OFF; -SELECT @@sql_buffer_result; - ---echo -SET @@sql_buffer_result = @sql_buffer_result_saved; - ---echo ---echo # Checking sql_quote_show_create... -SET @sql_quote_show_create_saved = @@sql_quote_show_create; - ---echo -SET @@sql_quote_show_create = ON; -SELECT @@sql_quote_show_create; - ---echo ---error ER_WRONG_VALUE_FOR_VAR -SET @@sql_quote_show_create = OF; -SELECT @@sql_quote_show_create; - ---echo -SET @@sql_quote_show_create = OFF; -SELECT @@sql_quote_show_create; - ---echo -SET @@sql_quote_show_create = @sql_quote_show_create_saved; - ---echo ---echo # End of Bug#34828. ---echo - --echo # Make sure we can manipulate with autocommit in the --echo # along with other variables. |