summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorDaniel Fiala <df@natsys-lab.com>2016-06-19 07:38:28 +0100
committerAleksey Midenkov <midenok@gmail.com>2017-05-05 20:35:08 +0300
commitbe6f2d302cd71677e1fafbeea9347c196f21e1bd (patch)
tree2814467d8c5585f852a47bef2caabea808b1c60d /mysql-test
parent14bdfa85416471e4ccd4aaa65397f282a2b508c3 (diff)
downloadmariadb-git-be6f2d302cd71677e1fafbeea9347c196f21e1bd.tar.gz
0.1: SQL-level System Versioning
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test4
-rw-r--r--mysql-test/include/common-tests.inc76
-rw-r--r--mysql-test/r/auto_increment.result59
-rw-r--r--mysql-test/r/compress.result114
-rw-r--r--mysql-test/r/create.result91
-rw-r--r--mysql-test/r/delete.result86
-rw-r--r--mysql-test/r/fulltext.result2
-rw-r--r--mysql-test/r/func_group.result2
-rw-r--r--mysql-test/r/func_time.result2
-rw-r--r--mysql-test/r/func_time_hires.result10
-rw-r--r--mysql-test/r/insert.result109
-rw-r--r--mysql-test/r/insert_select.result118
-rw-r--r--mysql-test/r/insert_update.result90
-rw-r--r--mysql-test/r/multi_update.result212
-rw-r--r--mysql-test/r/named_pipe.result114
-rw-r--r--mysql-test/r/pool_of_threads.result114
-rw-r--r--mysql-test/r/select.result179
-rw-r--r--mysql-test/r/select_jcl6.result179
-rw-r--r--mysql-test/r/select_pkeycache.result179
-rw-r--r--mysql-test/r/shm.result114
-rw-r--r--mysql-test/r/ssl.result114
-rw-r--r--mysql-test/r/ssl_compress.result114
-rw-r--r--mysql-test/r/update.result100
-rw-r--r--mysql-test/r/variables.result165
-rw-r--r--mysql-test/suite/archive/archive.result10
-rw-r--r--mysql-test/suite/archive/archive.test4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result10
-rw-r--r--mysql-test/suite/csv/csv.result16
-rw-r--r--mysql-test/suite/csv/csv.test8
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result8
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result8
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result8
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result11
-rw-r--r--mysql-test/suite/innodb_fts/r/fulltext.result2
-rw-r--r--mysql-test/suite/sys_vars/r/delay_key_write_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result227
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/low_priority_updates_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/old_passwords_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/sql_big_selects_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_big_tables_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_log_bin_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_log_off_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_notes_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sql_warnings_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/tx_read_only_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/t/delay_key_write_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test240
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/low_priority_updates_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/old_passwords_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/sql_big_selects_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_bin_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_log_off_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_notes_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/sql_warnings_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/tx_read_only_basic.test2
-rw-r--r--mysql-test/t/auto_increment.test34
-rw-r--r--mysql-test/t/create.test98
-rw-r--r--mysql-test/t/delete.test44
-rw-r--r--mysql-test/t/insert.test73
-rw-r--r--mysql-test/t/insert_select.test65
-rw-r--r--mysql-test/t/insert_update.test45
-rw-r--r--mysql-test/t/multi_update.test116
-rw-r--r--mysql-test/t/select.test110
-rw-r--r--mysql-test/t/update.test39
-rw-r--r--mysql-test/t/variables.test160
86 files changed, 2778 insertions, 1031 deletions
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index 90146d41471..0ffd24adc03 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -17,13 +17,13 @@ drop table if exists t1,t2;
--enable_warnings
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
) ENGINE=blackhole;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
+select period_ from t1;
select * from t1;
select t1.* from t1;
diff --git a/mysql-test/include/common-tests.inc b/mysql-test/include/common-tests.inc
index 204b6d4dd6b..c0ed1427215 100644
--- a/mysql-test/include/common-tests.inc
+++ b/mysql-test/include/common-tests.inc
@@ -14,13 +14,13 @@ drop table if exists t1,t2,t3,t4;
--enable_warnings
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;
@@ -1349,7 +1349,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;
@@ -1362,26 +1362,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;
@@ -1450,39 +1450,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.
@@ -1490,7 +1490,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..
@@ -1588,18 +1588,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;
@@ -1657,7 +1657,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;
@@ -1747,13 +1747,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
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 12cbf294b69..bb684d1930f 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -537,3 +537,62 @@ pk
-5
1
drop table t1;
+#
+# System Versioning Support
+#
+#
+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);
+t1.x = T1.x AND t1.y = T1.y x y x y
+1 1 11 1 11
+1 2 12 2 12
+1 3 13 3 13
+1 4 14 4 14
+1 5 15 5 15
+1 6 16 6 16
+1 7 17 7 17
+1 8 18 8 18
+1 9 19 9 19
+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);
+t1.x = T1.x AND t1.y = T1.y x y x y
+1 1 11 1 11
+1 3 13 3 13
+1 4 14 4 14
+1 5 15 5 15
+1 6 16 6 16
+1 7 17 7 17
+1 8 18 8 18
+1 9 19 9 19
+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);
+t1.x = T1.x AND t1.y = T1.y x y x y
+1 1 11 1 11
+1 3 13 3 13
+1 4 14 4 14
+1 5 15 5 15
+1 6 16 6 16
+1 7 17 7 17
+DROP TABLE t1;
+DROP TABLE T1;
diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result
index 762ab6630d8..b16a95cc702 100644
--- a/mysql-test/r/compress.result
+++ b/mysql-test/r/compress.result
@@ -7,18 +7,18 @@ VARIABLE_NAME VARIABLE_VALUE
COMPRESSION ON
drop table if exists t1,t2,t3,t4;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -282,8 +282,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -487,12 +487,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -606,35 +606,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1223,8 +1223,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1284,8 +1284,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1325,7 +1325,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1440,23 +1440,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1713,8 +1713,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2044,26 +2044,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 81b65c420cd..941ba2837d2 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -132,7 +132,7 @@ drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
Field Type Null Key Default Extra
-a datetime NO NULL
+a datetime YES NULL
b time NO NULL
c date NO NULL
d int(3) NO NULL
@@ -1931,3 +1931,92 @@ create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
Warnings:
Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release
drop table t1;
+#
+# Test for SYSTEM VERSIONING CREATE
+#
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `XNo` int(10) unsigned DEFAULT NULL,
+ `Sys_start` timestamp(6) NOT NULL GENERATED AS ROW START,
+ `Sys_end` timestamp(6) NOT NULL GENERATED AS ROW END,
+ PERIOD FOR SYSTEM_TIME (`Sys_start`, `Sys_end`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
+drop table if exists t1;
+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 HY000: 'Generated as row start' specified more than once
+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 HY000: Second column in 'period for system time' must be equal to 'generated as row end' 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,
+Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
+PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
+) WITH SYSTEM VERSIONING;
+ERROR HY000: Generated as row end specified more than once
+create table t1 (
+XNo INT UNSIGNED,
+PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
+) WITH SYSTEM VERSIONING;
+ERROR HY000: 'Generated as row start' not specified
+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 HY000: Generated as row end specified 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,
+PERIOD FOR SYSTEM_TIME (Sys_insert, Sys_remove)
+) WITH SYSTEM VERSIONING;
+ERROR HY000: First column in 'period for system time' must be equal to 'generated as row 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_start, Sys_end)
+);
+ERROR HY000: 'With system versioning' is missing
+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 HY000: 'Period for system_time' must contain two different columns
+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 HY000: System start field must be of type 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;
+ERROR HY000: System end field must be of type TIMESTAMP
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index ed3683d52f9..1ee160b6864 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -525,3 +525,89 @@ DELETE v2 FROM v2;
ERROR HY000: Can not delete from join view 'test.v2'
DROP VIEW v2, v1;
DROP TABLE t1, t2;
+#
+# Test for SYSTEM VERSIONING
+#
+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';
+XNo Sys_end < '2038-01-19 03:14:07'
+0 0
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 0
+9 0
+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';
+XNo Sys_end < '2038-01-19 03:14:07'
+0 1
+1 0
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 0
+9 0
+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';
+XNo Sys_end < '2038-01-19 03:14:07'
+0 1
+1 1
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 0
+9 0
+DELETE FROM t1 WHERE XNo > 5;
+CREATE VIEW vt1 AS SELECT XNo FROM t1;
+SELECT XNo FROM vt1;
+XNo
+2
+3
+4
+5
+DELETE FROM vt1 WHERE XNo = 3;
+SELECT XNo FROM vt1;
+XNo
+2
+4
+5
+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';
+XNo Sys_end < '2038-01-19 03:14:07'
+0 1
+1 1
+2 0
+3 1
+4 0
+5 0
+6 1
+7 1
+8 1
+9 1
+DROP VIEW vt1;
+DROP TABLE t1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 7ee5a68ca90..fa09d13b868 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -49,7 +49,7 @@ a b
Full-text indexes are called collections
Only MyISAM tables support collections
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'QUERY EXPANSION)' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH QUERY EXPANSION)' at line 1
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c85a50b2ea9..2b06467ce13 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -787,7 +787,7 @@ drop table t2;
create table t2 select f2 from (select now() f2 from t1) a;
show columns from t2;
Field Type Null Key Default Extra
-f2 datetime NO NULL
+f2 datetime YES NULL
drop table t2, t1;
CREATE TABLE t1(
id int PRIMARY KEY,
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 54da823c439..b721d7e1146 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -950,7 +950,7 @@ sec_to_time(1) + 0, from_unixtime(1) + 0;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `now() - now()` bigint(21) NOT NULL,
+ `now() - now()` bigint(21) DEFAULT NULL,
`curtime() - curtime()` bigint(12) NOT NULL,
`sec_to_time(1) + 0` bigint(12) DEFAULT NULL,
`from_unixtime(1) + 0` bigint(21) DEFAULT NULL
diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result
index 0f822456724..17c55d554bc 100644
--- a/mysql-test/r/func_time_hires.result
+++ b/mysql-test/r/func_time_hires.result
@@ -39,14 +39,14 @@ t1 CREATE TABLE `t1` (
`sec_to_time(12345)` time DEFAULT NULL,
`sec_to_time(12345.6789)` time(4) DEFAULT NULL,
`sec_to_time(1234567e-2)` time(6) DEFAULT NULL,
- `now()` datetime NOT NULL,
+ `now()` datetime DEFAULT NULL,
`curtime(0)` time NOT NULL,
- `utc_timestamp(1)` datetime(1) NOT NULL,
+ `utc_timestamp(1)` datetime(1) DEFAULT NULL,
`utc_time(2)` time(2) NOT NULL,
`current_time(3)` time(3) NOT NULL,
- `current_timestamp(4)` datetime(4) NOT NULL,
- `localtime(5)` datetime(5) NOT NULL,
- `localtimestamp(6)` datetime(6) NOT NULL,
+ `current_timestamp(4)` datetime(4) DEFAULT NULL,
+ `localtime(5)` datetime(5) DEFAULT NULL,
+ `localtimestamp(6)` datetime(6) DEFAULT NULL,
`time_to_sec(123456)` bigint(17) DEFAULT NULL,
`time_to_sec('12:34:56.789')` decimal(19,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index c9e3dc7b253..5837e1faa44 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -717,3 +717,112 @@ insert ignore into t1 values (1,12);
Warnings:
Warning 1062 Duplicate entry '1' for key 'f1'
DROP TABLE t1;
+#
+# System Versioning Support
+#
+#
+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;
+x y Sys_end
+3 4 2038-01-19 03:14:07.000000
+2 3 2038-01-19 03:14:07.000000
+40 33 2038-01-19 03:14:07.000000
+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;
+x y Sys_end
+3 4 2038-01-19 03:14:07.000000
+2 3 2038-01-19 03:14:07.000000
+40 33 2038-01-19 03:14:07.000000
+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;
+id x y Sys_end
+1 33 44 2038-01-19 03:14:07.000000
+20 33 44 2038-01-19 03:14:07.000000
+40 33 44 2038-01-19 03:14:07.000000
+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;
+id x y Sys_end
+1 33 44 2038-01-19 03:14:07.000000
+20 33 44 2038-01-19 03:14:07.000000
+40 33 44 2038-01-19 03:14:07.000000
+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);
+INSERT INTO t1(x, y, Sys_end) VALUES(8001, 9001, '2015-1-1 0:0:0');
+ERROR HY000: Generated field for System Versioning cannot be set by user
+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);
+INSERT INTO vt1_2 VALUES(3002, 4002, '2015-1-1 0:0:0');
+ERROR HY000: Generated field for System Versioning cannot be set by user
+SELECT x, y, Sys_end FROM t1;
+x y Sys_end
+8001 9001 2038-01-19 03:14:07.000000
+1001 2001 2038-01-19 03:14:07.000000
+1002 2002 2038-01-19 03:14:07.000000
+3001 4001 2038-01-19 03:14:07.000000
+SELECT x, y FROM vt1_1;
+x y
+8001 9001
+1001 2001
+1002 2002
+3001 4001
+SELECT x, y, Sys_end FROM vt1_2;
+x y Sys_end
+8001 9001 2038-01-19 03:14:07.000000
+1001 2001 2038-01-19 03:14:07.000000
+1002 2002 2038-01-19 03:14:07.000000
+3001 4001 2038-01-19 03:14:07.000000
+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);
+INSERT INTO t1(x, y, Sys_end) VALUES(8001, 9001, '2015-1-1 0:0:0');
+ERROR HY000: Generated field for System Versioning cannot be set by user
+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);
+INSERT INTO vt1_2 VALUES(3002, 4002, '2015-1-1 0:0:0');
+ERROR HY000: Generated field for System Versioning cannot be set by user
+SELECT x, y, Sys_end FROM t1;
+x y Sys_end
+8001 9001 2038-01-19 03:14:07.000000
+1001 2001 2038-01-19 03:14:07.000000
+1002 2002 2038-01-19 03:14:07.000000
+3001 4001 2038-01-19 03:14:07.000000
+SELECT x, y FROM vt1_1;
+x y
+8001 9001
+1001 2001
+1002 2002
+3001 4001
+SELECT x, y, Sys_end FROM vt1_2;
+x y Sys_end
+8001 9001 2038-01-19 03:14:07.000000
+1001 2001 2038-01-19 03:14:07.000000
+1002 2002 2038-01-19 03:14:07.000000
+3001 4001 2038-01-19 03:14:07.000000
+DROP TABLE t1;
+DROP VIEW vt1_1;
+DROP VIEW vt1_2;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 1a3a38b1f35..da236c53825 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -856,3 +856,121 @@ INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
DROP TABLE t1;
End of 5.1 tests
+#
+# System Versioning Support
+#
+#
+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;
+x y
+1 1001
+2 2001
+3 3001
+4 4001
+5 5001
+6 6001
+7 7001
+8 8001
+9 9001
+SELECT x, y FROM t2;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+1 1001
+2 2001
+3 3001
+4 4001
+5 5001
+6 6001
+7 7001
+8 8001
+9 9001
+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;
+x y
+1 1001
+2 2001
+3 3001
+4 4001
+5 5001
+6 6001
+7 7001
+8 8001
+9 9001
+SELECT x, y FROM t2;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+1 1001
+2 2001
+3 3001
+4 4001
+5 5001
+6 6001
+7 7001
+8 8001
+9 9001
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index e8e6e16fe5a..6f25fd18b6a 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -412,3 +412,93 @@ select if( @stamp1 = @stamp2, "correct", "wrong");
if( @stamp1 = @stamp2, "correct", "wrong")
correct
drop table t1;
+#
+# System Versioning Support
+#
+#
+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';
+x y
+1 1000
+2 2000
+3 3001
+4 4002
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+3 3000
+4 4000
+4 4001
+4 4444
+SELECT x, y FROM t1;
+x y
+1 1000
+2 2000
+3 3001
+4 4002
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+4 4444
+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';
+x y
+1 1000
+2 2000
+3 3000
+3 3001
+4 4000
+4 4001
+4 4002
+4 4444
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+SELECT x, y FROM t1;
+x y
+1 1000
+2 2000
+3 3001
+4 4002
+4 4444
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+DROP TABLE t1;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 634b3897ba0..35966f5ac1b 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -1002,3 +1002,215 @@ deallocate prepare stmt1;
drop view v3,v2,v1;
drop table t1,t2,t3;
end of 5.5 tests
+
+# Bug mdev-5970
+# Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD
+
+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;
+f1 f2
+6 97
+UPDATE v1 SET f1 = 1;
+SELECT * FROM v1;
+f1 f2
+1 97
+DROP TABLE t1, t2;
+DROP VIEW v1;
+#
+# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0
+# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE
+#
+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;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE IGNORE table_11757486 SET field1=128;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
+UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+ERROR 22003: Out of range value for column 'field1' at row 1
+UPDATE table_11757486 SET field1=128;
+ERROR 22003: Out of range value for column 'field1' at row 1
+SET SESSION SQL_MODE='';
+UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE IGNORE table_11757486 SET field1=128;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
+DROP TABLE table_11757486;
+SET SESSION SQL_MODE=default;
+end of 10.0 tests
+#
+# System Versioning Support
+#
+#
+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';
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8008
+9 9009
+8 8000
+9 9000
+SELECT x, y FROM t1;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8008
+9 9009
+SELECT x, y FROM t2 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0';
+x y
+1 1011
+2 2012
+3 3013
+4 4014
+5 5015
+6 6016
+7 7010
+8 8010
+9 9010
+1 1010
+2 2010
+3 3010
+4 4010
+5 5010
+6 6010
+SELECT x, y FROM t2;
+x y
+1 1011
+2 2012
+3 3013
+4 4014
+5 5015
+6 6016
+7 7010
+8 8010
+9 9010
+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';
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8008
+9 9009
+8 8000
+9 9000
+SELECT x, y FROM t1;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8008
+9 9009
+SELECT x, y FROM t2 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '9999-1-1 0:0:0';
+x y
+1 1011
+2 2012
+3 3013
+4 4014
+5 5015
+6 6016
+7 7010
+8 8010
+9 9010
+1 1010
+2 2010
+3 3010
+4 4010
+5 5010
+6 6010
+SELECT x, y FROM t2;
+x y
+1 1011
+2 2012
+3 3013
+4 4014
+5 5015
+6 6016
+7 7010
+8 8010
+9 9010
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/named_pipe.result b/mysql-test/r/named_pipe.result
index 66da9a874b4..b6c409e4590 100644
--- a/mysql-test/r/named_pipe.result
+++ b/mysql-test/r/named_pipe.result
@@ -1,18 +1,18 @@
connect pipe_con,localhost,root,,,,,PIPE;
drop table if exists t1,t2,t3,t4;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -276,8 +276,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -481,12 +481,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -600,35 +600,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1217,8 +1217,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1278,8 +1278,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1319,7 +1319,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1434,23 +1434,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1707,8 +1707,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2038,26 +2038,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
diff --git a/mysql-test/r/pool_of_threads.result b/mysql-test/r/pool_of_threads.result
index b25d8d1e50e..85ab577829a 100644
--- a/mysql-test/r/pool_of_threads.result
+++ b/mysql-test/r/pool_of_threads.result
@@ -2,18 +2,18 @@ SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
drop table if exists t1,t2,t3,t4;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -277,8 +277,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -482,12 +482,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -601,35 +601,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1218,8 +1218,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1279,8 +1279,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1320,7 +1320,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1435,23 +1435,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1708,8 +1708,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2039,26 +2039,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 5859bd0fae6..c260e2ff333 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -5,18 +5,18 @@ SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_select_test,'outer_join_with_cache=off');
set join_cache_level=1;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -280,8 +280,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -485,12 +485,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -604,35 +604,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1221,8 +1221,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1282,8 +1282,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1323,7 +1323,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1435,23 +1435,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1708,8 +1708,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2039,26 +2039,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
@@ -5548,3 +5548,68 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
NULL
drop table t1;
End of 10.0 tests
+#
+# System Versioning Support
+#
+#
+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;
+INSERT INTO t1(x, y) VALUES(3, 33);
+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;
+@time := Sys_start
+Sys_start
+SELECT x, y FROM t1;
+x y
+0 100
+1 101
+2 102
+4 104
+5 105
+6 106
+7 107
+3 33
+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;
+x y
+0 100
+1 101
+2 102
+3 103
+4 104
+5 105
+6 106
+7 107
+8 108
+9 109
+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;
+x y
+0 100
+1 101
+2 102
+3 103
+4 104
+5 105
+6 106
+7 107
+8 108
+9 109
+3 33
+SET @time=NULL;
+SET @query=NULL;
+DEALLOCATE PREPARE stmt_t1;
+DROP TABLE t1;
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index c9d582bb75a..ade583db19e 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -16,18 +16,18 @@ SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_select_test,'outer_join_with_cache=off');
set join_cache_level=@join_cache_level_for_select_test;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -291,8 +291,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -496,12 +496,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -615,35 +615,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
-1 SIMPLE t1 ref period period 4 test.t3.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 ALL period_ NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-select period from t1;
-period
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1232,8 +1232,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1293,8 +1293,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1334,7 +1334,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1446,23 +1446,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 func 1199 Using where; Using join buffer (flat, BNLH join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1719,8 +1719,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2050,26 +2050,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
@@ -5559,6 +5559,71 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
NULL
drop table t1;
End of 10.0 tests
+#
+# System Versioning Support
+#
+#
+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;
+INSERT INTO t1(x, y) VALUES(3, 33);
+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;
+@time := Sys_start
+Sys_start
+SELECT x, y FROM t1;
+x y
+0 100
+1 101
+2 102
+4 104
+5 105
+6 106
+7 107
+3 33
+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;
+x y
+0 100
+1 101
+2 102
+3 103
+4 104
+5 105
+6 106
+7 107
+8 108
+9 109
+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;
+x y
+0 100
+1 101
+2 102
+3 103
+4 104
+5 105
+6 106
+7 107
+8 108
+9 109
+3 33
+SET @time=NULL;
+SET @query=NULL;
+DEALLOCATE PREPARE stmt_t1;
+DROP TABLE t1;
set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 5859bd0fae6..c260e2ff333 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -5,18 +5,18 @@ SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_select_test,'outer_join_with_cache=off');
set join_cache_level=1;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -280,8 +280,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -485,12 +485,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -604,35 +604,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1221,8 +1221,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1282,8 +1282,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1323,7 +1323,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1435,23 +1435,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1708,8 +1708,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2039,26 +2039,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
@@ -5548,3 +5548,68 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
NULL
drop table t1;
End of 10.0 tests
+#
+# System Versioning Support
+#
+#
+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;
+INSERT INTO t1(x, y) VALUES(3, 33);
+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;
+@time := Sys_start
+Sys_start
+SELECT x, y FROM t1;
+x y
+0 100
+1 101
+2 102
+4 104
+5 105
+6 106
+7 107
+3 33
+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;
+x y
+0 100
+1 101
+2 102
+3 103
+4 104
+5 105
+6 106
+7 107
+8 108
+9 109
+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;
+x y
+0 100
+1 101
+2 102
+3 103
+4 104
+5 105
+6 106
+7 107
+8 108
+9 109
+3 33
+SET @time=NULL;
+SET @query=NULL;
+DEALLOCATE PREPARE stmt_t1;
+DROP TABLE t1;
diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result
index 65187b6b19b..4a2286a8104 100644
--- a/mysql-test/r/shm.result
+++ b/mysql-test/r/shm.result
@@ -1,18 +1,18 @@
connect shm_con,localhost,root,,,,$shm_name,SHM;
drop table if exists t1,t2,t3,t4;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -276,8 +276,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -481,12 +481,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -600,35 +600,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1217,8 +1217,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1278,8 +1278,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1319,7 +1319,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1434,23 +1434,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1707,8 +1707,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2038,26 +2038,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result
index ac18da81b93..6eb68e93be2 100644
--- a/mysql-test/r/ssl.result
+++ b/mysql-test/r/ssl.result
@@ -10,18 +10,18 @@ Variable_name Value
Ssl_server_not_after Apr 20 14:55:05 2035 GMT
drop table if exists t1,t2,t3,t4;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -285,8 +285,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -490,12 +490,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -609,35 +609,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1226,8 +1226,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1287,8 +1287,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1328,7 +1328,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1443,23 +1443,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1716,8 +1716,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2047,26 +2047,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result
index 4e37cc68a24..d195816caa9 100644
--- a/mysql-test/r/ssl_compress.result
+++ b/mysql-test/r/ssl_compress.result
@@ -7,18 +7,18 @@ Variable_name Value
Compression ON
drop table if exists t1,t2,t3,t4;
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;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null auto_increment,
@@ -282,8 +282,8 @@ companynr
34
29
00
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-fld3 period
+select distinct t2.fld3,period_ from t2,t1 where companynr=37 and fld3 like "O%";
+fld3 period_
obliterates 9410
offload 9410
opaquely 9410
@@ -487,12 +487,12 @@ acu
Ade
adj
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)
);
create temporary table tmp engine = myisam select * from t3;
@@ -606,35 +606,35 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index
-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_;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
+1 SIMPLE t1 ALL period_ NULL NULL NULL 41810 Using filesort
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t3.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t3 index period period 4 NULL 1
-1 SIMPLE t1 ref period period 4 test.t3.period 4181
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
+1 SIMPLE t3 index period_ period_ 4 NULL 1
+1 SIMPLE t1 ref period_ period_ 4 test.t3.period_ 4181
+explain select * from t3 as t1,t3 where t1.period_=t3.period_ order by t1.period_ limit 10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index period period 4 NULL 1
-1 SIMPLE t3 ref period period 4 test.t1.period 4181
-select period from t1;
-period
+1 SIMPLE t1 index period_ period_ 4 NULL 1
+1 SIMPLE t3 ref period_ period_ 4 test.t1.period_ 4181
+select period_ from t1;
+period_
9410
-select period from t1 where period=1900;
-period
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-fld3 period
+select period_ from t1 where period_=1900;
+period_
+select fld3,period_ from t1,t2 where fld1 = 011401 order by period_;
+fld3 period_
breaking 9410
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-fld3 period
+select fld3,period_ from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period_=1001;
+fld3 period_
breaking 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_;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const fld1 fld1 4 const 1
-1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-fld3 period
+1 SIMPLE t3 const PRIMARY,period_ PRIMARY 4 const 1
+select fld3,period_ from t2,t1 where companynr*10 = 37*10;
+fld3 period_
breaking 9410
Romans 9410
intercepted 9410
@@ -1223,8 +1223,8 @@ dusted 9410
encompasses 9410
presentation 9410
Kantian 9410
-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;
-fld3 period price price2
+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;
+fld3 period_ price price2
admonishing 1002 28357832 8723648
analyzable 1002 28357832 8723648
annihilates 1001 5987435 234724
@@ -1284,8 +1284,8 @@ ventilate 1001 5987435 234724
wallet 1001 5987435 234724
Weissmuller 1002 28357832 8723648
Wotan 1002 28357832 8723648
-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;
-fld1 fld3 period price price2
+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;
+fld1 fld3 period_ price price2
018201 relaxing 1001 5987435 234724
018601 vacuuming 1001 5987435 234724
018801 inch 1001 5987435 234724
@@ -1325,7 +1325,7 @@ companynr companyname
65 company 9
68 company 10
select * from t1,t1 t12;
-Period Varor_period Period Varor_period
+Period_ Varor_period Period_ Varor_period
9410 9412 9410 9412
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
fld1 fld1
@@ -1440,23 +1440,23 @@ explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join)
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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;
-fld1 companynr fld3 period
+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;
+fld1 companynr fld3 period_
038008 37 reporters 1008
038208 37 Selfridge 1008
-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);
-period
+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);
+period_
9410
-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)));
-period
+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)));
+period_
9410
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;
fld1
@@ -1713,8 +1713,8 @@ companynr companyname count(*)
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
fld1 count(*)
158402 4181
-select sum(Period)/count(*) from t1;
-sum(Period)/count(*)
+select sum(Period_)/count(*) from t1;
+sum(Period_)/count(*)
9410.0000
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;
companynr count sum diff func
@@ -2044,26 +2044,26 @@ t2nr count(*)
select max(t2nr) from t3 where price=983543950;
max(t2nr)
41807
-select t1.period from t3 = t1 limit 1;
-period
+select t1.period_ from t3 = t1 limit 1;
+period_
1001
-select t1.period from t1 as t1 limit 1;
-period
+select t1.period_ from t1 as t1 limit 1;
+period_
9410
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-Nuvarande period
+select t1.period_ as "Nuvarande period_" from t1 as t1 limit 1;
+Nuvarande period_
9410
-select period as ok_period from t1 limit 1;
+select period_ as ok_period from t1 limit 1;
ok_period
9410
-select period as ok_period from t1 group by ok_period limit 1;
+select period_ as ok_period from t1 group by ok_period limit 1;
ok_period
9410
select 1+1 as summa from t1 group by summa limit 1;
summa
2
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-Nuvarande period
+select period_ as "Nuvarande period_" from t1 group by "Nuvarande period_" limit 1;
+Nuvarande period_
9410
show tables;
Tables_in_test
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 73ebb73e313..cab57d4ef3d 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -719,3 +719,103 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
drop table t1, t2;
# End of MariaDB 10.0 tests
+#
+# System Versioning Support
+#
+#
+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;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+UPDATE t1 SET y = y + 1 WHERE x > 7;
+SELECT x, y FROM t1;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8001
+9 9001
+SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07';
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8001
+9 9001
+8 8000
+9 9000
+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;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8000
+9 9000
+UPDATE t1 SET y = y + 1 WHERE x > 7;
+SELECT x, y FROM t1;
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8001
+9 9001
+SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0000-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07';
+x y
+1 1000
+2 2000
+3 3000
+4 4000
+5 5000
+6 6000
+7 7000
+8 8001
+9 9001
+8 8000
+9 9000
+DROP TABLE t1;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 676432690b4..944e8c1392e 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1577,171 +1577,6 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
End of 5.1 tests
-
-#
-# Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes.
-#
-
-# Checking sql_notes...
-SET @sql_notes_saved = @@sql_notes;
-
-SET @@sql_notes = ON;
-SELECT @@sql_notes;
-@@sql_notes
-1
-
-SET @@sql_notes = OF;
-ERROR 42000: Variable 'sql_notes' can't be set to the value of 'OF'
-SELECT @@sql_notes;
-@@sql_notes
-1
-
-SET @@sql_notes = OFF;
-SELECT @@sql_notes;
-@@sql_notes
-0
-
-SET @@sql_notes = @sql_notes_saved;
-
-# Checking delay_key_write...
-SET @delay_key_write_saved = @@delay_key_write;
-
-SET GLOBAL delay_key_write = ON;
-SELECT @@delay_key_write;
-@@delay_key_write
-ON
-
-SET GLOBAL delay_key_write = OF;
-ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'OF'
-SELECT @@delay_key_write;
-@@delay_key_write
-ON
-
-SET GLOBAL delay_key_write = AL;
-ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'AL'
-SELECT @@delay_key_write;
-@@delay_key_write
-ON
-
-SET GLOBAL delay_key_write = OFF;
-SELECT @@delay_key_write;
-@@delay_key_write
-OFF
-
-SET GLOBAL delay_key_write = ALL;
-SELECT @@delay_key_write;
-@@delay_key_write
-ALL
-
-SET GLOBAL delay_key_write = @delay_key_write_saved;
-
-# Checking sql_safe_updates...
-SET @sql_safe_updates_saved = @@sql_safe_updates;
-
-SET @@sql_safe_updates = ON;
-SELECT @@sql_safe_updates;
-@@sql_safe_updates
-1
-
-SET @@sql_safe_updates = OF;
-ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'OF'
-SELECT @@sql_safe_updates;
-@@sql_safe_updates
-1
-
-SET @@sql_safe_updates = OFF;
-SELECT @@sql_safe_updates;
-@@sql_safe_updates
-0
-
-SET @@sql_safe_updates = @sql_safe_updates_saved;
-
-# Checking foreign_key_checks...
-SET @foreign_key_checks_saved = @@foreign_key_checks;
-
-SET @@foreign_key_checks = ON;
-SELECT @@foreign_key_checks;
-@@foreign_key_checks
-1
-
-SET @@foreign_key_checks = OF;
-ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'OF'
-SELECT @@foreign_key_checks;
-@@foreign_key_checks
-1
-
-SET @@foreign_key_checks = OFF;
-SELECT @@foreign_key_checks;
-@@foreign_key_checks
-0
-
-SET @@foreign_key_checks = @foreign_key_checks_saved;
-
-# Checking unique_checks...
-SET @unique_checks_saved = @@unique_checks;
-
-SET @@unique_checks = ON;
-SELECT @@unique_checks;
-@@unique_checks
-1
-
-SET @@unique_checks = OF;
-ERROR 42000: Variable 'unique_checks' can't be set to the value of 'OF'
-SELECT @@unique_checks;
-@@unique_checks
-1
-
-SET @@unique_checks = OFF;
-SELECT @@unique_checks;
-@@unique_checks
-0
-
-SET @@unique_checks = @unique_checks_saved;
-
-# Checking sql_buffer_result...
-SET @sql_buffer_result_saved = @@sql_buffer_result;
-
-SET @@sql_buffer_result = ON;
-SELECT @@sql_buffer_result;
-@@sql_buffer_result
-1
-
-SET @@sql_buffer_result = OF;
-ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'OF'
-SELECT @@sql_buffer_result;
-@@sql_buffer_result
-1
-
-SET @@sql_buffer_result = OFF;
-SELECT @@sql_buffer_result;
-@@sql_buffer_result
-0
-
-SET @@sql_buffer_result = @sql_buffer_result_saved;
-
-# Checking sql_quote_show_create...
-SET @sql_quote_show_create_saved = @@sql_quote_show_create;
-
-SET @@sql_quote_show_create = ON;
-SELECT @@sql_quote_show_create;
-@@sql_quote_show_create
-1
-
-SET @@sql_quote_show_create = OF;
-ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'OF'
-SELECT @@sql_quote_show_create;
-@@sql_quote_show_create
-1
-
-SET @@sql_quote_show_create = OFF;
-SELECT @@sql_quote_show_create;
-@@sql_quote_show_create
-0
-
-SET @@sql_quote_show_create = @sql_quote_show_create_saved;
-
-# End of Bug#34828.
-
# Make sure we can manipulate with autocommit in the
# along with other variables.
drop table if exists t1;
diff --git a/mysql-test/suite/archive/archive.result b/mysql-test/suite/archive/archive.result
index d294d3dfe58..f0ef14495fa 100644
--- a/mysql-test/suite/archive/archive.result
+++ b/mysql-test/suite/archive/archive.result
@@ -3,18 +3,18 @@ call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
SET storage_engine=ARCHIVE;
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
) ENGINE=archive;
INSERT INTO t1 VALUES (9410,9412);
-select period FROM t1;
-period
+select period_ FROM t1;
+period_
9410
select * FROM t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* FROM t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int,
diff --git a/mysql-test/suite/archive/archive.test b/mysql-test/suite/archive/archive.test
index 30f2766507e..19b46195682 100644
--- a/mysql-test/suite/archive/archive.test
+++ b/mysql-test/suite/archive/archive.test
@@ -15,13 +15,13 @@ SET storage_engine=ARCHIVE;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
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
) ENGINE=archive;
INSERT INTO t1 VALUES (9410,9412);
-select period FROM t1;
+select period_ FROM t1;
select * FROM t1;
select t1.* FROM t1;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index feed949a71a..ac2b2003f30 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -1,16 +1,16 @@
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
drop table if exists t1,t2;
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
) ENGINE=blackhole;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
-period
+select period_ from t1;
+period_
select * from t1;
-Period Varor_period
+Period_ Varor_period
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
CREATE TABLE t2 (
auto int NOT NULL auto_increment,
fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
diff --git a/mysql-test/suite/csv/csv.result b/mysql-test/suite/csv/csv.result
index 220b84b222e..c9f7c617b40 100644
--- a/mysql-test/suite/csv/csv.result
+++ b/mysql-test/suite/csv/csv.result
@@ -3,18 +3,18 @@ call mtr.add_suppression("Table 'test_repair_table4' is marked as crashed and sh
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
drop table if exists t1,t2,t3,t4;
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
) ENGINE = CSV;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
-period
+select period_ from t1;
+period_
9410
select * from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
select t1.* from t1;
-Period Varor_period
+Period_ Varor_period
9410 9412
CREATE TABLE t2 (
auto int not null,
@@ -4919,12 +4919,12 @@ DROP TABLE t1;
ALTER TABLE t2 RENAME t1;
DROP TABLE t1;
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
) ENGINE = CSV;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
-period
+select period_ from t1;
+period_
9410
drop table if exists t1,t2,t3,t4;
Warnings:
diff --git a/mysql-test/suite/csv/csv.test b/mysql-test/suite/csv/csv.test
index 3da9aca7b16..711351a32ae 100644
--- a/mysql-test/suite/csv/csv.test
+++ b/mysql-test/suite/csv/csv.test
@@ -17,13 +17,13 @@ drop table if exists t1,t2,t3,t4;
--enable_warnings
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
) ENGINE = CSV;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
+select period_ from t1;
select * from t1;
select t1.* from t1;
@@ -1308,13 +1308,13 @@ ALTER TABLE t2 RENAME t1;
DROP TABLE t1;
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
) ENGINE = CSV;
INSERT INTO t1 VALUES (9410,9412);
-select period from t1;
+select period_ from t1;
drop table if exists t1,t2,t3,t4;
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 294e0695226..759ab6fd327 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -3551,11 +3551,11 @@ CREATE VIEW v1 or REPLACE AS Select * from tb2 my_table;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'or REPLACE AS Select * from tb2 my_table' at line 1
CREATE VIEW v1 WITH CASCADED CHECK OPTION AS Select *
from tb2 my_table limit 50;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION AS Select *
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION AS Select *
from tb2 my_table limit 50' at line 1
CREATE VIEW v1 WITH LOCAL CHECK OPTION AS Select *
from tb2 my_table limit 50;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LOCAL CHECK OPTION AS Select *
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH LOCAL CHECK OPTION AS Select *
from tb2 my_table limit 50' at line 1
SELECT * FROM tb2 my_table CREATE VIEW As v1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE VIEW As v1' at line 1
@@ -3585,7 +3585,7 @@ FROM test.tb2 my_table CHECK OPTION WITH CASCADED;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHECK OPTION WITH CASCADED' at line 2
CREATE OR REPLACE VIEW v1 WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table' at line 1
CREATE OR REPLACE AS SELECT F59, F60
FROM test.tb2 my_table VIEW v1 WITH CASCADED CHECK OPTION;
@@ -3614,7 +3614,7 @@ FROM test.tb2 my_table CHECK OPTION WITH LOCAL;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHECK OPTION WITH LOCAL' at line 2
CREATE OR REPLACE VIEW v1 WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table' at line 1
CREATE OR REPLACE AS SELECT F59, F60
FROM test.tb2 my_table VIEW v1 WITH LOCAL CHECK OPTION;
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 87465035980..60a9d2a3f2e 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -3552,11 +3552,11 @@ CREATE VIEW v1 or REPLACE AS Select * from tb2 my_table;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'or REPLACE AS Select * from tb2 my_table' at line 1
CREATE VIEW v1 WITH CASCADED CHECK OPTION AS Select *
from tb2 my_table limit 50;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION AS Select *
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION AS Select *
from tb2 my_table limit 50' at line 1
CREATE VIEW v1 WITH LOCAL CHECK OPTION AS Select *
from tb2 my_table limit 50;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LOCAL CHECK OPTION AS Select *
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH LOCAL CHECK OPTION AS Select *
from tb2 my_table limit 50' at line 1
SELECT * FROM tb2 my_table CREATE VIEW As v1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE VIEW As v1' at line 1
@@ -3586,7 +3586,7 @@ FROM test.tb2 my_table CHECK OPTION WITH CASCADED;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHECK OPTION WITH CASCADED' at line 2
CREATE OR REPLACE VIEW v1 WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table' at line 1
CREATE OR REPLACE AS SELECT F59, F60
FROM test.tb2 my_table VIEW v1 WITH CASCADED CHECK OPTION;
@@ -3615,7 +3615,7 @@ FROM test.tb2 my_table CHECK OPTION WITH LOCAL;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHECK OPTION WITH LOCAL' at line 2
CREATE OR REPLACE VIEW v1 WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table' at line 1
CREATE OR REPLACE AS SELECT F59, F60
FROM test.tb2 my_table VIEW v1 WITH LOCAL CHECK OPTION;
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index 9296b9d98a2..420a400905b 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -4054,11 +4054,11 @@ CREATE VIEW v1 or REPLACE AS Select * from tb2 my_table;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'or REPLACE AS Select * from tb2 my_table' at line 1
CREATE VIEW v1 WITH CASCADED CHECK OPTION AS Select *
from tb2 my_table limit 50;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION AS Select *
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION AS Select *
from tb2 my_table limit 50' at line 1
CREATE VIEW v1 WITH LOCAL CHECK OPTION AS Select *
from tb2 my_table limit 50;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LOCAL CHECK OPTION AS Select *
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH LOCAL CHECK OPTION AS Select *
from tb2 my_table limit 50' at line 1
SELECT * FROM tb2 my_table CREATE VIEW As v1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE VIEW As v1' at line 1
@@ -4088,7 +4088,7 @@ FROM test.tb2 my_table CHECK OPTION WITH CASCADED;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHECK OPTION WITH CASCADED' at line 2
CREATE OR REPLACE VIEW v1 WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table' at line 1
CREATE OR REPLACE AS SELECT F59, F60
FROM test.tb2 my_table VIEW v1 WITH CASCADED CHECK OPTION;
@@ -4117,7 +4117,7 @@ FROM test.tb2 my_table CHECK OPTION WITH LOCAL;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHECK OPTION WITH LOCAL' at line 2
CREATE OR REPLACE VIEW v1 WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CASCADED CHECK OPTION
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH CASCADED CHECK OPTION
AS SELECT F59, F60 FROM test.tb2 my_table' at line 1
CREATE OR REPLACE AS SELECT F59, F60
FROM test.tb2 my_table VIEW v1 WITH LOCAL CHECK OPTION;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 2c86e6c3e73..29d3b23211b 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -2807,7 +2807,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE with()
SELECT * from t1 where f2=f1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'with()
SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE write()
SELECT * from t1 where f2=f1;
@@ -9222,7 +9222,7 @@ CREATE PROCEDURE sp1()
BEGIN
declare with char;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'char;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'with char;
END' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
@@ -11574,9 +11574,8 @@ BEGIN
declare with condition for sqlstate '02000';
declare exit handler for with set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'condition for sqlstate '02000';
-declare exit handler for with set @var2 = 1;
-END' at line 3
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'with condition for sqlstate '02000';
+declare exit handler for with set @var2 = 1' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -13680,7 +13679,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare with handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'with handler for sqlstate '02000' set @var2 = 1;
END' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result
index f096f1c7dd5..84822109e2e 100644
--- a/mysql-test/suite/innodb_fts/r/fulltext.result
+++ b/mysql-test/suite/innodb_fts/r/fulltext.result
@@ -57,7 +57,7 @@ Only MyISAM tables support collections
MySQL has now support for full-text search
Full-text search in MySQL implements vector space model
select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'QUERY EXPANSION)' at line 1
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH QUERY EXPANSION)' at line 1
explain select * from t1 where MATCH(a,b) AGAINST ("collections");
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 fulltext a a 0 1 Using where
diff --git a/mysql-test/suite/sys_vars/r/delay_key_write_basic.result b/mysql-test/suite/sys_vars/r/delay_key_write_basic.result
index 2258d7af078..7299737f63b 100644
--- a/mysql-test/suite/sys_vars/r/delay_key_write_basic.result
+++ b/mysql-test/suite/sys_vars/r/delay_key_write_basic.result
@@ -37,8 +37,8 @@ SET @@global.delay_key_write = FALSE0;
ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'FALSE0'
SET @@global.delay_key_write = ONN;
ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'ONN'
-SET @@global.delay_key_write = OF;
-ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'OF'
+SET @@global.delay_key_write = OFFF;
+ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'OFFF'
SET @@global.delay_key_write = ' ';
ERROR 42000: Variable 'delay_key_write' can't be set to the value of ' '
SET @@global.delay_key_write = "";
diff --git a/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result
index 834d693edb8..f33ef34a62a 100644
--- a/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result
+++ b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result
@@ -43,8 +43,8 @@ SET @@session.foreign_key_checks = TRÜE;
ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'TRÜE'
SET @@session.foreign_key_checks = ÕN;
ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'ÕN'
-SET @@session.foreign_key_checks = OF;
-ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'OF'
+SET @@session.foreign_key_checks = OFFF;
+ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'OFFF'
SET @@session.foreign_key_checks = ÓFF;
ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'ÓFF'
SET @@session.foreign_key_checks = '¹';
diff --git a/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result b/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result
new file mode 100644
index 00000000000..5c66ff41355
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result
@@ -0,0 +1,227 @@
+SET @session_start_value = @@session.innodb_support_xa;
+SELECT @session_start_value;
+@session_start_value
+1
+SET @global_start_value = @@global.innodb_support_xa;
+SELECT @global_start_value;
+@global_start_value
+1
+'#--------------------FN_DYNVARS_046_01------------------------#'
+SET @@session.innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SET @@session.innodb_support_xa = DEFAULT;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@global.innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SET @@global.innodb_support_xa = DEFAULT;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+'#---------------------FN_DYNVARS_046_02-------------------------#'
+SET innodb_support_xa = 1;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@innodb_support_xa;
+@@innodb_support_xa
+1
+SELECT session.innodb_support_xa;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT local.innodb_support_xa;
+ERROR 42S02: Unknown table 'local' in field list
+SELECT global.innodb_support_xa;
+ERROR 42S02: Unknown table 'global' in field list
+SET session innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET global innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+'#--------------------FN_DYNVARS_046_03------------------------#'
+SET @@session.innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@session.innodb_support_xa = 1;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@global.innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SET @@global.innodb_support_xa = 1;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+'#--------------------FN_DYNVARS_046_04-------------------------#'
+SET @@session.innodb_support_xa = -0.6;
+ERROR 42000: Incorrect argument type to variable 'innodb_support_xa'
+SET @@session.innodb_support_xa = 1.6;
+ERROR 42000: Incorrect argument type to variable 'innodb_support_xa'
+SET @@session.innodb_support_xa = "T";
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'T'
+SET @@session.innodb_support_xa = "Y";
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'Y'
+SET @@session.innodb_support_xa = TRÜE;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'TRÜE'
+SET @@session.innodb_support_xa = ÕN;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'ÕN'
+SET @@session.innodb_support_xa = OFF;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@session.innodb_support_xa = ÓFF;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'ÓFF'
+SET @@global.innodb_support_xa = -1;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of '-1'
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SET @@global.innodb_support_xa = 2;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of '2'
+SET @@global.innodb_support_xa = "T";
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'T'
+SET @@global.innodb_support_xa = "Y";
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'Y'
+SET @@global.innodb_support_xa = TRÜE;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'TRÜE'
+SET @@global.innodb_support_xa = ÕN;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'ÕN'
+SET @@global.innodb_support_xa = OFF;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SET @@global.innodb_support_xa = ÓFF;
+ERROR 42000: Variable 'innodb_support_xa' can't be set to the value of 'ÓFF'
+'#-------------------FN_DYNVARS_046_05----------------------------#'
+SET @@global.innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SET @@session.innodb_support_xa = 1;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@global.innodb_support_xa AS res_is_0;
+res_is_0
+1
+SET @@global.innodb_support_xa = 0;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@session.innodb_support_xa AS res_is_1;
+res_is_1
+1
+'#----------------------FN_DYNVARS_046_06------------------------#'
+SELECT IF(@@global.innodb_support_xa, "ON", "OFF") =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_support_xa';
+IF(@@global.innodb_support_xa, "ON", "OFF") =
+VARIABLE_VALUE
+1
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_support_xa';
+VARIABLE_VALUE
+ON
+'#----------------------FN_DYNVARS_046_07------------------------#'
+SELECT IF(@@session.innodb_support_xa, "ON", "OFF") =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='innodb_support_xa';
+IF(@@session.innodb_support_xa, "ON", "OFF") =
+VARIABLE_VALUE
+1
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='innodb_support_xa';
+VARIABLE_VALUE
+ON
+'#---------------------FN_DYNVARS_046_08-------------------------#'
+SET @@session.innodb_support_xa = OFF;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@session.innodb_support_xa = ON;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@global.innodb_support_xa = OFF;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SET @@global.innodb_support_xa = ON;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+'#---------------------FN_DYNVARS_046_09----------------------#'
+SET @@session.innodb_support_xa = TRUE;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@session.innodb_support_xa = FALSE;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@global.innodb_support_xa = TRUE;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SET @@global.innodb_support_xa = FALSE;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
+SET @@session.innodb_support_xa = @session_start_value;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@session.innodb_support_xa;
+@@session.innodb_support_xa
+1
+SET @@global.innodb_support_xa = @global_start_value;
+Warnings:
+Warning 131 Using innodb_support_xa is deprecated and the parameter may be removed in future releases.
+SELECT @@global.innodb_support_xa;
+@@global.innodb_support_xa
+1
diff --git a/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result b/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result
index 08dc5d7aaca..aec529aece2 100644
--- a/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result
@@ -66,7 +66,7 @@ SET @@session.innodb_table_locks = TRÜE;
ERROR 42000: Variable 'innodb_table_locks' can't be set to the value of 'TRÜE'
SET @@session.innodb_table_locks = ÕN;
ERROR 42000: Variable 'innodb_table_locks' can't be set to the value of 'ÕN'
-SET @@session.innodb_table_locks = OF;
+SET @@session.innodb_table_locks = OFF;
SELECT @@session.innodb_table_locks;
@@session.innodb_table_locks
0
@@ -84,7 +84,7 @@ SET @@global.innodb_table_locks = TRÜE;
ERROR 42000: Variable 'innodb_table_locks' can't be set to the value of 'TRÜE'
SET @@global.innodb_table_locks = QN;
ERROR 42000: Variable 'innodb_table_locks' can't be set to the value of 'QN'
-SET @@global.innodb_table_locks = OF;
+SET @@global.innodb_table_locks = OFF;
SELECT @@global.innodb_table_locks;
@@global.innodb_table_locks
0
diff --git a/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result
index b7deea88a9c..8e9f7308b73 100644
--- a/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result
+++ b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result
@@ -101,8 +101,8 @@ SET @@session.keep_files_on_create = ONN;
ERROR 42000: Variable 'keep_files_on_create' can't be set to the value of 'ONN'
SET @@session.keep_files_on_create = ONF;
ERROR 42000: Variable 'keep_files_on_create' can't be set to the value of 'ONF'
-SET @@session.keep_files_on_create = OF;
-ERROR 42000: Variable 'keep_files_on_create' can't be set to the value of 'OF'
+SET @@session.keep_files_on_create = OFFF;
+ERROR 42000: Variable 'keep_files_on_create' can't be set to the value of 'OFFF'
SET @@session.keep_files_on_create = 'OFN';
ERROR 42000: Variable 'keep_files_on_create' can't be set to the value of 'OFN'
SET @@session.keep_files_on_create = -2;
diff --git a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result
index 7ed1b689f5a..d3d2e97d249 100644
--- a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result
+++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result
@@ -50,8 +50,8 @@ SET @@global.log_bin_trust_function_creators = 'ONN';
ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'ONN'
SET @@global.log_bin_trust_function_creators = "OFFF";
ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'OFFF'
-SET @@global.log_bin_trust_function_creators = OF;
-ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'OF'
+SET @@global.log_bin_trust_function_creators = OFFF;
+ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'OFFF'
SET @@global.log_bin_trust_function_creators = TTRUE;
ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'TTRUE'
SET @@global.log_bin_trust_function_creators = FELSE;
diff --git a/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result
index 633dc274dec..9e514c8cb35 100644
--- a/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result
+++ b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result
@@ -101,8 +101,8 @@ SET @@session.low_priority_updates = ONN;
ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'ONN'
SET @@session.low_priority_updates = ONF;
ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'ONF'
-SET @@session.low_priority_updates = OF;
-ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'OF'
+SET @@session.low_priority_updates = OFFF;
+ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'OFFF'
SET @@session.low_priority_updates = 'OFN';
ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'OFN'
SET @@session.low_priority_updates = -2;
diff --git a/mysql-test/suite/sys_vars/r/old_passwords_basic.result b/mysql-test/suite/sys_vars/r/old_passwords_basic.result
index 26d0e79071b..dba84b18b11 100644
--- a/mysql-test/suite/sys_vars/r/old_passwords_basic.result
+++ b/mysql-test/suite/sys_vars/r/old_passwords_basic.result
@@ -97,8 +97,8 @@ SET @@session.old_passwords = ONN;
ERROR 42000: Variable 'old_passwords' can't be set to the value of 'ONN'
SET @@session.old_passwords = ONF;
ERROR 42000: Variable 'old_passwords' can't be set to the value of 'ONF'
-SET @@session.old_passwords = OF;
-ERROR 42000: Variable 'old_passwords' can't be set to the value of 'OF'
+SET @@session.old_passwords = OFFF;
+ERROR 42000: Variable 'old_passwords' can't be set to the value of 'OFFF'
SET @@session.old_passwords = 'OFN';
ERROR 42000: Variable 'old_passwords' can't be set to the value of 'OFN'
SET @@session.old_passwords = -2;
diff --git a/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result b/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result
index 99843f0b93f..c22107292cd 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_prune_level_basic.result
@@ -104,7 +104,7 @@ SET @@session.optimizer_prune_level = ONF;
ERROR 42000: Incorrect argument type to variable 'optimizer_prune_level'
SET @@session.optimizer_prune_level = ON;
ERROR 42000: Incorrect argument type to variable 'optimizer_prune_level'
-SET @@session.optimizer_prune_level = OF;
+SET @@session.optimizer_prune_level = OFFF;
ERROR 42000: Incorrect argument type to variable 'optimizer_prune_level'
SET @@session.optimizer_prune_level = 'OFN';
ERROR 42000: Incorrect argument type to variable 'optimizer_prune_level'
diff --git a/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result
index c98dd338909..cec880bf1d5 100644
--- a/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result
@@ -58,8 +58,8 @@ SET @@session.pseudo_slave_mode = TRÜE;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'TRÜE'
SET @@session.pseudo_slave_mode = ÕN;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'ÕN'
-SET @@session.pseudo_slave_mode = OF;
-ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'OF'
+SET @@session.pseudo_slave_mode = OFFF;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'OFFF'
SET @@session.pseudo_slave_mode = ÓFF;
ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'ÓFF'
SET @@session.pseudo_slave_mode = '¹';
diff --git a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result
index 96f42bbbda3..26169b4b979 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result
@@ -66,8 +66,8 @@ SET @@session.query_cache_wlock_invalidate = TRÜE;
ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'TRÜE'
SET @@session.query_cache_wlock_invalidate = ÕN;
ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'ÕN'
-SET @@session.query_cache_wlock_invalidate = OF;
-ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'OF'
+SET @@session.query_cache_wlock_invalidate = OFFF;
+ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'OFFF'
SET @@session.query_cache_wlock_invalidate = ÓFF;
ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'ÓFF'
SET @@global.query_cache_wlock_invalidate = -1;
@@ -82,8 +82,8 @@ SET @@global.query_cache_wlock_invalidate = TRÜE;
ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'TRÜE'
SET @@global.query_cache_wlock_invalidate = ÕN;
ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'ÕN'
-SET @@global.query_cache_wlock_invalidate = OF;
-ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'OF'
+SET @@global.query_cache_wlock_invalidate = OFFF;
+ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'OFFF'
SET @@global.query_cache_wlock_invalidate = ÓFF;
ERROR 42000: Variable 'query_cache_wlock_invalidate' can't be set to the value of 'ÓFF'
'#-------------------FN_DYNVARS_135_05----------------------------#'
diff --git a/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result b/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result
index 98f05bda488..fc16ecc06f2 100644
--- a/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result
@@ -43,8 +43,8 @@ SET @@session.sql_big_selects = TRÜE;
ERROR 42000: Variable 'sql_big_selects' can't be set to the value of 'TRÜE'
SET @@session.sql_big_selects = ÕN;
ERROR 42000: Variable 'sql_big_selects' can't be set to the value of 'ÕN'
-SET @@session.sql_big_selects = OF;
-ERROR 42000: Variable 'sql_big_selects' can't be set to the value of 'OF'
+SET @@session.sql_big_selects = OFFF;
+ERROR 42000: Variable 'sql_big_selects' can't be set to the value of 'OFFF'
SET @@session.sql_big_selects = ÓFF;
ERROR 42000: Variable 'sql_big_selects' can't be set to the value of 'ÓFF'
SET @@session.sql_big_selects = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result
index 09553ae7d57..91081a78328 100644
--- a/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result
@@ -48,7 +48,7 @@ SET @@session.sql_big_tables = TRÜE;
ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'TRÜE'
SET @@session.sql_big_tables = ÕN;
ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'ÕN'
-SET @@session.sql_big_tables = OF;
+SET @@session.sql_big_tables = OFFF;
ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'OF'
SET @@session.sql_big_tables = ÓFF;
ERROR 42000: Variable 'sql_big_tables' can't be set to the value of 'ÓFF'
diff --git a/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result b/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result
index 2dfdcb26898..83597ef47cb 100644
--- a/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result
@@ -48,8 +48,8 @@ SET @@session.sql_buffer_result = TRÜE;
ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'TRÜE'
SET @@session.sql_buffer_result = ÕN;
ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'ÕN'
-SET @@session.sql_buffer_result = OF;
-ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'OF'
+SET @@session.sql_buffer_result = OFFF;
+ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'OFFF'
SET @@session.sql_buffer_result = ÓFF;
ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'ÓFF'
SET @@session.sql_buffer_result = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result b/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result
index 909c434340c..a909019fc50 100644
--- a/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result
@@ -48,8 +48,8 @@ SET @@session.sql_log_bin = TRÜE;
ERROR 42000: Variable 'sql_log_bin' can't be set to the value of 'TRÜE'
SET @@session.sql_log_bin = ÕN;
ERROR 42000: Variable 'sql_log_bin' can't be set to the value of 'ÕN'
-SET @@session.sql_log_bin = OF;
-ERROR 42000: Variable 'sql_log_bin' can't be set to the value of 'OF'
+SET @@session.sql_log_bin = OFFF;
+ERROR 42000: Variable 'sql_log_bin' can't be set to the value of 'OFFF'
SET @@session.sql_log_bin = ÓFF;
ERROR 42000: Variable 'sql_log_bin' can't be set to the value of 'ÓFF'
SET @@session.sql_log_bin = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_log_off_basic.result b/mysql-test/suite/sys_vars/r/sql_log_off_basic.result
index c2ffa17c5fe..0cb5b576127 100644
--- a/mysql-test/suite/sys_vars/r/sql_log_off_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_log_off_basic.result
@@ -48,8 +48,8 @@ SET @@session.sql_log_off = TRÜE;
ERROR 42000: Variable 'sql_log_off' can't be set to the value of 'TRÜE'
SET @@session.sql_log_off = ÕN;
ERROR 42000: Variable 'sql_log_off' can't be set to the value of 'ÕN'
-SET @@session.sql_log_off = OF;
-ERROR 42000: Variable 'sql_log_off' can't be set to the value of 'OF'
+SET @@session.sql_log_off = OFFF;
+ERROR 42000: Variable 'sql_log_off' can't be set to the value of 'OFFF'
SET @@session.sql_log_off = ÓFF;
ERROR 42000: Variable 'sql_log_off' can't be set to the value of 'ÓFF'
SET @@session.sql_log_off = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result
index 28bc53e5718..ed493e038ca 100644
--- a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result
@@ -63,7 +63,7 @@ SET @@session.sql_low_priority_updates = TRÜE;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'TRÜE'
SET @@session.sql_low_priority_updates = ÕN;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'ÕN'
-SET @@session.sql_low_priority_updates = OF;
+SET @@session.sql_low_priority_updates = OFFF;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'OF'
SET @@session.sql_low_priority_updates = ÓFF;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'ÓFF'
@@ -79,7 +79,7 @@ SET @@global.sql_low_priority_updates = TRÜE;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'TRÜE'
SET @@global.sql_low_priority_updates = ÕN;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'ÕN'
-SET @@global.sql_low_priority_updates = OF;
+SET @@global.sql_low_priority_updates = OFFF;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'OF'
SET @@global.sql_low_priority_updates = ÓFF;
ERROR 42000: Variable 'sql_low_priority_updates' can't be set to the value of 'ÓFF'
diff --git a/mysql-test/suite/sys_vars/r/sql_notes_basic.result b/mysql-test/suite/sys_vars/r/sql_notes_basic.result
index 7a54f90f8b7..18a846874ab 100644
--- a/mysql-test/suite/sys_vars/r/sql_notes_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_notes_basic.result
@@ -48,8 +48,8 @@ SET @@session.sql_notes = TRÜE;
ERROR 42000: Variable 'sql_notes' can't be set to the value of 'TRÜE'
SET @@session.sql_notes = ÕN;
ERROR 42000: Variable 'sql_notes' can't be set to the value of 'ÕN'
-SET @@session.sql_notes = OF;
-ERROR 42000: Variable 'sql_notes' can't be set to the value of 'OF'
+SET @@session.sql_notes = OFFF;
+ERROR 42000: Variable 'sql_notes' can't be set to the value of 'OFFF'
SET @@session.sql_notes = ÓFF;
ERROR 42000: Variable 'sql_notes' can't be set to the value of 'ÓFF'
SET @@session.sql_notes = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result b/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result
index 8cf99233ef9..97715ae2089 100644
--- a/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result
@@ -48,8 +48,8 @@ SET @@session.sql_quote_show_create = TRÜE;
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
SET @@session.sql_quote_show_create = ÕN;
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'ÕN'
-SET @@session.sql_quote_show_create = OF;
-ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'OF'
+SET @@session.sql_quote_show_create = OFFF;
+ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'OFFF'
SET @@session.sql_quote_show_create = ÓFF;
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'ÓFF'
SET @@session.sql_quote_show_create = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result b/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result
index 91bfcb2377e..4bdcc8f6b47 100644
--- a/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result
@@ -48,8 +48,8 @@ SET @@session.sql_safe_updates = TRÜE;
ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'TRÜE'
SET @@session.sql_safe_updates = ÕN;
ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'ÕN'
-SET @@session.sql_safe_updates = OF;
-ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'OF'
+SET @@session.sql_safe_updates = OFFF;
+ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'OFFF'
SET @@session.sql_safe_updates = ÓFF;
ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'ÓFF'
SET @@session.sql_safe_updates = '¹';
diff --git a/mysql-test/suite/sys_vars/r/sql_warnings_basic.result b/mysql-test/suite/sys_vars/r/sql_warnings_basic.result
index 762182336c3..f9cae0c7f7a 100644
--- a/mysql-test/suite/sys_vars/r/sql_warnings_basic.result
+++ b/mysql-test/suite/sys_vars/r/sql_warnings_basic.result
@@ -46,8 +46,8 @@ SET @@session.sql_warnings = TRÜE;
ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'TRÜE'
SET @@session.sql_warnings = ÕN;
ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'ÕN'
-SET @@session.sql_warnings = OF;
-ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'OF'
+SET @@session.sql_warnings = OFFF;
+ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'OFFF'
SET @@session.sql_warnings = ÓFF;
ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'ÓFF'
SET @@session.sql_warnings = '¹';
diff --git a/mysql-test/suite/sys_vars/r/tx_read_only_basic.result b/mysql-test/suite/sys_vars/r/tx_read_only_basic.result
index 3750145083f..e8f5da31c5a 100644
--- a/mysql-test/suite/sys_vars/r/tx_read_only_basic.result
+++ b/mysql-test/suite/sys_vars/r/tx_read_only_basic.result
@@ -102,8 +102,8 @@ SET @@session.tx_read_only = ONN;
ERROR 42000: Variable 'tx_read_only' can't be set to the value of 'ONN'
SET @@session.tx_read_only = ONF;
ERROR 42000: Variable 'tx_read_only' can't be set to the value of 'ONF'
-SET @@session.tx_read_only = OF;
-ERROR 42000: Variable 'tx_read_only' can't be set to the value of 'OF'
+SET @@session.tx_read_only = OFFF;
+ERROR 42000: Variable 'tx_read_only' can't be set to the value of 'OFFF'
SET @@session.tx_read_only = 'OFN';
ERROR 42000: Variable 'tx_read_only' can't be set to the value of 'OFN'
SET @@session.tx_read_only = -2;
diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_basic.test b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test
index 25176879eb1..2856993cb6c 100644
--- a/mysql-test/suite/sys_vars/t/delay_key_write_basic.test
+++ b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test
@@ -90,7 +90,7 @@ SET @@global.delay_key_write = FALSE0;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.delay_key_write = ONN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.delay_key_write = OF;
+SET @@global.delay_key_write = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.delay_key_write = ' ';
diff --git a/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test
index 8a327ab699b..b1fc9997cfa 100644
--- a/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test
+++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test
@@ -94,7 +94,7 @@ SET @@session.foreign_key_checks = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.foreign_key_checks = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.foreign_key_checks = OF;
+SET @@session.foreign_key_checks = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.foreign_key_checks = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test
new file mode 100644
index 00000000000..f8ce5852769
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test
@@ -0,0 +1,240 @@
+################# mysql-test\t\innodb_support_xa_basic.test ###################
+# #
+# Variable Name: innodb_support_xa #
+# Scope: GLOBAL | SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: 1 #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-20 #
+# Author: Rizwan #
+# #
+# Description: Test Cases of Dynamic System Variable innodb_support_xa #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/have_innodb.inc
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF innodb_support_xa TESTS #
+########################################################################
+
+
+################################################################################
+# Saving initial value of innodb_support_xa in a temporary variable #
+################################################################################
+
+
+SET @session_start_value = @@session.innodb_support_xa;
+SELECT @session_start_value;
+
+
+SET @global_start_value = @@global.innodb_support_xa;
+SELECT @global_start_value;
+
+
+
+--echo '#--------------------FN_DYNVARS_046_01------------------------#'
+########################################################################
+# Display the DEFAULT value of innodb_support_xa #
+########################################################################
+
+SET @@session.innodb_support_xa = 0;
+SET @@session.innodb_support_xa = DEFAULT;
+SELECT @@session.innodb_support_xa;
+
+SET @@global.innodb_support_xa = 0;
+SET @@global.innodb_support_xa = DEFAULT;
+SELECT @@global.innodb_support_xa;
+
+--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
+##########################################################################
+# Check if innodb_support_xa can be accessed with and without @@ sign #
+##########################################################################
+
+SET innodb_support_xa = 1;
+SELECT @@innodb_support_xa;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.innodb_support_xa;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.innodb_support_xa;
+
+--Error ER_UNKNOWN_TABLE
+SELECT global.innodb_support_xa;
+#using another syntax for accessing system variables
+SET session innodb_support_xa = 0;
+SELECT @@session.innodb_support_xa;
+
+SET global innodb_support_xa = 0;
+SELECT @@global.innodb_support_xa;
+
+
+--echo '#--------------------FN_DYNVARS_046_03------------------------#'
+##########################################################################
+# change the value of innodb_support_xa to a valid value #
+##########################################################################
+# for session
+SET @@session.innodb_support_xa = 0;
+SELECT @@session.innodb_support_xa;
+SET @@session.innodb_support_xa = 1;
+SELECT @@session.innodb_support_xa;
+
+# for global
+SET @@global.innodb_support_xa = 0;
+SELECT @@global.innodb_support_xa;
+SET @@global.innodb_support_xa = 1;
+SELECT @@global.innodb_support_xa;
+
+
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_support_xa to invalid value #
+###########################################################################
+
+# for session
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_support_xa = -0.6;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.innodb_support_xa = 1.6;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_support_xa = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_support_xa = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_support_xa = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_support_xa = ÕN;
+
+SET @@session.innodb_support_xa = OFF;
+SELECT @@session.innodb_support_xa;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.innodb_support_xa = ÓFF;
+
+# for global
+
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = -1;
+SELECT @@global.innodb_support_xa;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = ÕN;
+
+SET @@global.innodb_support_xa = OFF;
+SELECT @@global.innodb_support_xa;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_support_xa = ÓFF;
+
+
+--echo '#-------------------FN_DYNVARS_046_05----------------------------#'
+###########################################################################
+# Test if changing global variable effects session and vice versa #
+###########################################################################
+
+SET @@global.innodb_support_xa = 0;
+SET @@session.innodb_support_xa = 1;
+SELECT @@global.innodb_support_xa AS res_is_0;
+
+SET @@global.innodb_support_xa = 0;
+SELECT @@session.innodb_support_xa AS res_is_1;
+
+--echo '#----------------------FN_DYNVARS_046_06------------------------#'
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT IF(@@global.innodb_support_xa, "ON", "OFF") =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_support_xa';
+--enable_warnings
+SELECT @@global.innodb_support_xa;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_support_xa';
+--enable_warnings
+
+
+--echo '#----------------------FN_DYNVARS_046_07------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+--disable_warnings
+SELECT IF(@@session.innodb_support_xa, "ON", "OFF") =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='innodb_support_xa';
+--enable_warnings
+SELECT @@session.innodb_support_xa;
+--disable_warnings
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+ WHERE VARIABLE_NAME='innodb_support_xa';
+--enable_warnings
+
+
+--echo '#---------------------FN_DYNVARS_046_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.innodb_support_xa = OFF;
+SELECT @@session.innodb_support_xa;
+SET @@session.innodb_support_xa = ON;
+SELECT @@session.innodb_support_xa;
+
+SET @@global.innodb_support_xa = OFF;
+SELECT @@global.innodb_support_xa;
+SET @@global.innodb_support_xa = ON;
+SELECT @@global.innodb_support_xa;
+
+--echo '#---------------------FN_DYNVARS_046_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.innodb_support_xa = TRUE;
+SELECT @@session.innodb_support_xa;
+SET @@session.innodb_support_xa = FALSE;
+SELECT @@session.innodb_support_xa;
+
+SET @@global.innodb_support_xa = TRUE;
+SELECT @@global.innodb_support_xa;
+SET @@global.innodb_support_xa = FALSE;
+SELECT @@global.innodb_support_xa;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.innodb_support_xa = @session_start_value;
+SELECT @@session.innodb_support_xa;
+
+SET @@global.innodb_support_xa = @global_start_value;
+SELECT @@global.innodb_support_xa;
+
+###############################################################
+# END OF innodb_support_xa TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test
index e3e4bda345e..25be5daa552 100644
--- a/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test
@@ -119,7 +119,7 @@ SET @@session.innodb_table_locks = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.innodb_table_locks = ÕN;
-SET @@session.innodb_table_locks = OF;
+SET @@session.innodb_table_locks = OFF;
SELECT @@session.innodb_table_locks;
--Error ER_WRONG_VALUE_FOR_VAR
@@ -141,7 +141,7 @@ SET @@global.innodb_table_locks = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.innodb_table_locks = QN;
-SET @@global.innodb_table_locks = OF;
+SET @@global.innodb_table_locks = OFF;
SELECT @@global.innodb_table_locks;
--Error ER_WRONG_TYPE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test
index e6141af4bbe..cfa50e72146 100644
--- a/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test
+++ b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test
@@ -132,7 +132,7 @@ SET @@session.keep_files_on_create = ONN;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.keep_files_on_create = ONF;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.keep_files_on_create = OF;
+SET @@session.keep_files_on_create = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.keep_files_on_create = 'OFN';
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test
index 15ffad2742a..1db6bf41e6f 100644
--- a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test
+++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test
@@ -96,7 +96,7 @@ SET @@global.log_bin_trust_function_creators = 'ONN';
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.log_bin_trust_function_creators = "OFFF";
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.log_bin_trust_function_creators = OF;
+SET @@global.log_bin_trust_function_creators = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.log_bin_trust_function_creators = TTRUE;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test
index e00688ef974..703036b8e36 100644
--- a/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test
+++ b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test
@@ -132,7 +132,7 @@ SET @@session.low_priority_updates = ONN;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.low_priority_updates = ONF;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.low_priority_updates = OF;
+SET @@session.low_priority_updates = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.low_priority_updates = 'OFN';
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/old_passwords_basic.test b/mysql-test/suite/sys_vars/t/old_passwords_basic.test
index f4965ad7528..038a77edf8f 100644
--- a/mysql-test/suite/sys_vars/t/old_passwords_basic.test
+++ b/mysql-test/suite/sys_vars/t/old_passwords_basic.test
@@ -131,7 +131,7 @@ SET @@session.old_passwords = ONN;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.old_passwords = ONF;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.old_passwords = OF;
+SET @@session.old_passwords = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.old_passwords = 'OFN';
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test
index 1e3a8bc3d7f..374be2db6ae 100644
--- a/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test
+++ b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test
@@ -140,7 +140,7 @@ SET @@session.optimizer_prune_level = ONF;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_prune_level = ON;
--Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.optimizer_prune_level = OF;
+SET @@session.optimizer_prune_level = OFFF;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.optimizer_prune_level = 'OFN';
diff --git a/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
index 3ef39bb8667..6d1dca299c6 100644
--- a/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
+++ b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
@@ -97,7 +97,7 @@ SET @@session.pseudo_slave_mode = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.pseudo_slave_mode = OF;
+SET @@session.pseudo_slave_mode = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.pseudo_slave_mode = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test
index 055c3629d15..c883d9b789a 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test
@@ -116,7 +116,7 @@ SET @@session.query_cache_wlock_invalidate = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.query_cache_wlock_invalidate = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.query_cache_wlock_invalidate = OF;
+SET @@session.query_cache_wlock_invalidate = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.query_cache_wlock_invalidate = ÓFF;
@@ -135,7 +135,7 @@ SET @@global.query_cache_wlock_invalidate = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.query_cache_wlock_invalidate = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.query_cache_wlock_invalidate = OF;
+SET @@global.query_cache_wlock_invalidate = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.query_cache_wlock_invalidate = ÓFF;
diff --git a/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test
index 42331d766be..52345b71144 100644
--- a/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test
@@ -94,7 +94,7 @@ SET @@session.sql_big_selects = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_big_selects = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_big_selects = OF;
+SET @@session.sql_big_selects = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_big_selects = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test
index f5f99efeb0a..2475bd9cd8a 100644
--- a/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test
@@ -100,7 +100,7 @@ SET @@session.sql_buffer_result = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_buffer_result = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_buffer_result = OF;
+SET @@session.sql_buffer_result = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_buffer_result = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test
index 5f5e3920862..7e133200d5f 100644
--- a/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test
@@ -98,7 +98,7 @@ SET @@session.sql_log_bin = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_log_bin = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_log_bin = OF;
+SET @@session.sql_log_bin = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_log_bin = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_basic.test b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test
index 38549ac35d2..a48d3bbfda6 100644
--- a/mysql-test/suite/sys_vars/t/sql_log_off_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test
@@ -97,7 +97,7 @@ SET @@session.sql_log_off = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_log_off = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_log_off = OF;
+SET @@session.sql_log_off = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_log_off = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_notes_basic.test b/mysql-test/suite/sys_vars/t/sql_notes_basic.test
index 9af5fa35ea2..204ebe3fe84 100644
--- a/mysql-test/suite/sys_vars/t/sql_notes_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_notes_basic.test
@@ -99,7 +99,7 @@ SET @@session.sql_notes = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_notes = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_notes = OF;
+SET @@session.sql_notes = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_notes = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test
index 020b5f51e9f..8e8118b998b 100644
--- a/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test
@@ -98,7 +98,7 @@ SET @@session.sql_quote_show_create = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_quote_show_create = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_quote_show_create = OF;
+SET @@session.sql_quote_show_create = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_quote_show_create = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test
index 66148b65aaf..89208cae0ef 100644
--- a/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test
@@ -97,7 +97,7 @@ SET @@session.sql_safe_updates = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_safe_updates = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_safe_updates = OF;
+SET @@session.sql_safe_updates = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_safe_updates = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sql_warnings_basic.test b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test
index ced58f96e15..f32b6f33f89 100644
--- a/mysql-test/suite/sys_vars/t/sql_warnings_basic.test
+++ b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test
@@ -98,7 +98,7 @@ SET @@session.sql_warnings = TRÜE;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_warnings = ÕN;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.sql_warnings = OF;
+SET @@session.sql_warnings = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.sql_warnings = ÓFF;
--Error ER_WRONG_VALUE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/tx_read_only_basic.test b/mysql-test/suite/sys_vars/t/tx_read_only_basic.test
index 0ebfcc31a89..8c6ab0e3d59 100644
--- a/mysql-test/suite/sys_vars/t/tx_read_only_basic.test
+++ b/mysql-test/suite/sys_vars/t/tx_read_only_basic.test
@@ -116,7 +116,7 @@ SET @@session.tx_read_only = ONN;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.tx_read_only = ONF;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@session.tx_read_only = OF;
+SET @@session.tx_read_only = OFFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@session.tx_read_only = 'OFN';
--Error ER_WRONG_VALUE_FOR_VAR
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.