0.1: SQL-level System Versioning
This commit is contained in:
parent
14bdfa8541
commit
be6f2d302c
@ -184,6 +184,16 @@ enum enum_indicator_type
|
||||
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3U << FIELD_FLAGS_COLUMN_FORMAT)
|
||||
#define FIELD_IS_DROPPED (1U << 26) /* Intern: Field is being dropped */
|
||||
|
||||
#define GENERATED_ROW_START_FLAG (1 << 27) /* autogenerated column declared with
|
||||
`generated always at row start`
|
||||
(see II.a SQL Standard) */
|
||||
#define GENERATED_ROW_END_FLAG (1 << 28) /* autogenerated column declared with
|
||||
`generated always at row end`
|
||||
(see II.a SQL Standard).*/
|
||||
#define WITHOUT_SYSTEM_VERSIONING_FLAG (1 << 29) /* column that doesn't support
|
||||
system versioning when table
|
||||
itself supports it*/
|
||||
|
||||
#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */
|
||||
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */
|
||||
#define REFRESH_TABLES (1ULL << 2) /* close all tables */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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 = "";
|
||||
|
@ -43,8 +43,8 @@ SET @@session.foreign_key_checks = TR
|
||||
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 = '¹';
|
||||
|
227
mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result
Normal file
227
mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result
Normal file
@ -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
|
@ -66,7 +66,7 @@ SET @@session.innodb_table_locks = TR
|
||||
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
|
||||
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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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'
|
||||
|
@ -58,8 +58,8 @@ SET @@session.pseudo_slave_mode = TR
|
||||
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 = '¹';
|
||||
|
@ -66,8 +66,8 @@ SET @@session.query_cache_wlock_invalidate = TR
|
||||
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
|
||||
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----------------------------#'
|
||||
|
@ -43,8 +43,8 @@ SET @@session.sql_big_selects = TR
|
||||
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 = '¹';
|
||||
|
@ -48,7 +48,7 @@ SET @@session.sql_big_tables = TR
|
||||
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'
|
||||
|
@ -48,8 +48,8 @@ SET @@session.sql_buffer_result = TR
|
||||
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 = '¹';
|
||||
|
@ -48,8 +48,8 @@ SET @@session.sql_log_bin = TR
|
||||
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 = '¹';
|
||||
|
@ -48,8 +48,8 @@ SET @@session.sql_log_off = TR
|
||||
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 = '¹';
|
||||
|
@ -63,7 +63,7 @@ SET @@session.sql_low_priority_updates = TR
|
||||
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
|
||||
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'
|
||||
|
@ -48,8 +48,8 @@ SET @@session.sql_notes = TR
|
||||
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 = '¹';
|
||||
|
@ -48,8 +48,8 @@ SET @@session.sql_quote_show_create = TR
|
||||
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 = '¹';
|
||||
|
@ -48,8 +48,8 @@ SET @@session.sql_safe_updates = TR
|
||||
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 = '¹';
|
||||
|
@ -46,8 +46,8 @@ SET @@session.sql_warnings = TR
|
||||
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 = '¹';
|
||||
|
@ -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;
|
||||
|
@ -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 = ' ';
|
||||
|
@ -94,7 +94,7 @@ SET @@session.foreign_key_checks = TR
|
||||
--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
|
||||
|
240
mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test
Normal file
240
mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test
Normal file
@ -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 #
|
||||
###############################################################
|
@ -119,7 +119,7 @@ SET @@session.innodb_table_locks = TR
|
||||
--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
|
||||
--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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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';
|
||||
|
@ -97,7 +97,7 @@ SET @@session.pseudo_slave_mode = TR
|
||||
--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
|
||||
|
@ -116,7 +116,7 @@ SET @@session.query_cache_wlock_invalidate = TR
|
||||
--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
|
||||
--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;
|
||||
|
||||
|
@ -94,7 +94,7 @@ SET @@session.sql_big_selects = TR
|
||||
--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
|
||||
|
@ -100,7 +100,7 @@ SET @@session.sql_buffer_result = TR
|
||||
--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
|
||||
|
@ -98,7 +98,7 @@ SET @@session.sql_log_bin = TR
|
||||
--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
|
||||
|
@ -97,7 +97,7 @@ SET @@session.sql_log_off = TR
|
||||
--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
|
||||
|
@ -99,7 +99,7 @@ SET @@session.sql_notes = TR
|
||||
--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
|
||||
|
@ -98,7 +98,7 @@ SET @@session.sql_quote_show_create = TR
|
||||
--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
|
||||
|
@ -97,7 +97,7 @@ SET @@session.sql_safe_updates = TR
|
||||
--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
|
||||
|
@ -98,7 +98,7 @@ SET @@session.sql_warnings = TR
|
||||
--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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
||||
|
16
sql/field.cc
16
sql/field.cc
@ -5423,6 +5423,22 @@ void Field_timestampf::store_TIME(my_time_t timestamp, ulong sec_part)
|
||||
my_timestamp_to_binary(&tm, ptr, dec);
|
||||
}
|
||||
|
||||
bool Field_timestampf::set_max_timestamp()
|
||||
{
|
||||
DBUG_ENTER("Field_timestampf::set_max_timestamp");
|
||||
|
||||
mi_int4store(ptr, 0x7fffffff);
|
||||
memset(ptr + 4, 0x0, value_length() - 4);
|
||||
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool Field_timestampf::is_max_timestamp()
|
||||
{
|
||||
DBUG_ENTER("Field_timestampf::is_max_timestamp");
|
||||
|
||||
DBUG_RETURN(mi_sint4korr(ptr) == 0x7fffffff);
|
||||
}
|
||||
|
||||
my_time_t Field_timestampf::get_timestamp(const uchar *pos,
|
||||
ulong *sec_part) const
|
||||
|
67
sql/field.h
67
sql/field.h
@ -33,6 +33,8 @@
|
||||
#include "compat56.h"
|
||||
#include "sql_type.h" /* Type_std_attributes */
|
||||
|
||||
#include <limits>
|
||||
|
||||
class Send_field;
|
||||
class Copy_field;
|
||||
class Protocol;
|
||||
@ -674,6 +676,19 @@ public:
|
||||
static void operator delete(void *ptr, MEM_ROOT *mem_root)
|
||||
{ DBUG_ASSERT(0); }
|
||||
|
||||
/**
|
||||
Is used by System Versioning.
|
||||
*/
|
||||
virtual bool set_max_timestamp() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
Is used by System Versioning.
|
||||
*/
|
||||
virtual bool is_max_timestamp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
uchar *ptr; // Position to field in record
|
||||
/**
|
||||
Byte where the @c NULL bit is stored inside a record. If this Field is a
|
||||
@ -1391,6 +1406,56 @@ public:
|
||||
FIELD_FLAGS_COLUMN_FORMAT;
|
||||
}
|
||||
|
||||
/*
|
||||
System versioning support.
|
||||
*/
|
||||
|
||||
bool is_generated()
|
||||
{
|
||||
return flags & (GENERATED_ROW_START_FLAG | GENERATED_ROW_END_FLAG);
|
||||
}
|
||||
|
||||
bool is_generated_row_start()
|
||||
{
|
||||
return flags & GENERATED_ROW_START_FLAG;
|
||||
}
|
||||
|
||||
bool is_generated_row_end()
|
||||
{
|
||||
return flags & GENERATED_ROW_END_FLAG;
|
||||
}
|
||||
|
||||
bool is_versioning_disabled()
|
||||
{
|
||||
return flags & WITHOUT_SYSTEM_VERSIONING_FLAG;
|
||||
}
|
||||
|
||||
/* Mark a field as auto-generated row start column. */
|
||||
void set_generated_row_start()
|
||||
{
|
||||
//DBUG_ASSERT((flags & GENERATED_ROW_END_FLAG) == 0);
|
||||
flags |= GENERATED_ROW_START_FLAG;
|
||||
}
|
||||
|
||||
/* Mark a field as auto-generated row start column. */
|
||||
void set_generated_row_end()
|
||||
{
|
||||
//DBUG_ASSERT((flags & GENERATED_ROW_START_FLAG) == 0);
|
||||
flags |= GENERATED_ROW_END_FLAG;
|
||||
}
|
||||
|
||||
/* Disable a field versioning for a versioned table. */
|
||||
void disable_versioning()
|
||||
{
|
||||
flags |= WITHOUT_SYSTEM_VERSIONING_FLAG;
|
||||
}
|
||||
|
||||
/* Inherit a field versioning status from the table. */
|
||||
void inherit_versioning()
|
||||
{
|
||||
flags &= ~WITHOUT_SYSTEM_VERSIONING_FLAG;
|
||||
}
|
||||
|
||||
/*
|
||||
Validate a non-null field value stored in the given record
|
||||
according to the current thread settings, e.g. sql_mode.
|
||||
@ -2517,6 +2582,8 @@ public:
|
||||
{
|
||||
return memcmp(a_ptr, b_ptr, pack_length());
|
||||
}
|
||||
virtual bool set_max_timestamp();
|
||||
virtual bool is_max_timestamp();
|
||||
void store_TIME(my_time_t timestamp, ulong sec_part);
|
||||
my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
|
@ -1660,6 +1660,36 @@ struct Schema_specification_st
|
||||
};
|
||||
|
||||
|
||||
struct System_versioning_info
|
||||
{
|
||||
struct
|
||||
{
|
||||
String *start, *end;
|
||||
} period_for_system_time;
|
||||
|
||||
struct
|
||||
{
|
||||
String *start;
|
||||
String *end;
|
||||
} generated_as_row;
|
||||
|
||||
void set_period_for_system_time(String *start, String *end)
|
||||
{
|
||||
period_for_system_time.start = start;
|
||||
period_for_system_time.end = end;
|
||||
}
|
||||
void set_period_for_system_time()
|
||||
{
|
||||
set_period_for_system_time(NULL, NULL);
|
||||
}
|
||||
|
||||
/** User has added 'WITH SYSTEM VERSIONING' to table definition */
|
||||
bool declared_system_versioning;
|
||||
|
||||
/** Table described by this structure have enabled system versioning */
|
||||
bool versioned;
|
||||
};
|
||||
|
||||
/**
|
||||
A helper struct for table DDL statements, e.g.:
|
||||
CREATE [OR REPLACE] [TEMPORARY]
|
||||
@ -1734,6 +1764,8 @@ struct Table_scope_and_contents_source_st
|
||||
bool table_was_deleted;
|
||||
sequence_definition *seq_create_info;
|
||||
|
||||
System_versioning_info system_versioning_info;
|
||||
|
||||
void init()
|
||||
{
|
||||
bzero(this, sizeof(*this));
|
||||
@ -1744,6 +1776,17 @@ struct Table_scope_and_contents_source_st
|
||||
db_type= tmp_table() ? ha_default_tmp_handlerton(thd)
|
||||
: ha_default_handlerton(thd);
|
||||
}
|
||||
|
||||
bool versioned()
|
||||
{
|
||||
return system_versioning_info.versioned;
|
||||
}
|
||||
const System_versioning_info *get_system_versioning_info()
|
||||
{
|
||||
if (!versioned())
|
||||
return NULL;
|
||||
return &system_versioning_info;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1702,6 +1702,15 @@ void Item_func_curtime_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
Item_func_now::Item_func_now(THD *thd, uint dec) :
|
||||
Item_datetimefunc(thd, new (thd->mem_root) Item_decimal(thd, dec, TRUE)),
|
||||
last_query_id(0)
|
||||
{
|
||||
decimals = dec;
|
||||
}
|
||||
|
||||
|
||||
bool Item_func_now::fix_fields(THD *thd, Item **items)
|
||||
{
|
||||
if (decimals > TIME_SECOND_PART_DIGITS)
|
||||
|
@ -718,8 +718,7 @@ class Item_func_now :public Item_datetimefunc
|
||||
MYSQL_TIME ltime;
|
||||
query_id_t last_query_id;
|
||||
public:
|
||||
Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0)
|
||||
{ decimals= dec; }
|
||||
Item_func_now(THD *thd, uint dec);
|
||||
bool fix_fields(THD *, Item **);
|
||||
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
|
||||
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0;
|
||||
|
@ -458,6 +458,7 @@ static SYMBOL symbols[] = {
|
||||
{ "PAGE_CHECKSUM", SYM(PAGE_CHECKSUM_SYM)},
|
||||
{ "PARSER", SYM(PARSER_SYM)},
|
||||
{ "PARSE_VCOL_EXPR", SYM(PARSE_VCOL_EXPR_SYM)},
|
||||
{ "PERIOD", SYM(PERIOD_SYM)},
|
||||
{ "PARTIAL", SYM(PARTIAL)},
|
||||
{ "PARTITION", SYM(PARTITION_SYM)},
|
||||
{ "PARTITIONING", SYM(PARTITIONING_SYM)},
|
||||
@ -625,6 +626,8 @@ static SYMBOL symbols[] = {
|
||||
{ "SUSPEND", SYM(SUSPEND_SYM)},
|
||||
{ "SWAPS", SYM(SWAPS_SYM)},
|
||||
{ "SWITCHES", SYM(SWITCHES_SYM)},
|
||||
{ "SYSTEM", SYM(SYSTEM)},
|
||||
{ "SYSTEM_TIME", SYM(SYSTEM_TIME_SYM)},
|
||||
{ "TABLE", SYM(TABLE_SYM)},
|
||||
{ "TABLE_NAME", SYM(TABLE_NAME_SYM)},
|
||||
{ "TABLES", SYM(TABLES)},
|
||||
@ -690,6 +693,7 @@ static SYMBOL symbols[] = {
|
||||
{ "VIA", SYM(VIA_SYM)},
|
||||
{ "VIEW", SYM(VIEW_SYM)},
|
||||
{ "VIRTUAL", SYM(VIRTUAL_SYM)},
|
||||
{ "VERSIONING", SYM(VERSIONING)},
|
||||
{ "WAIT", SYM(WAIT_SYM)},
|
||||
{ "WARNINGS", SYM(WARNINGS)},
|
||||
{ "WEEK", SYM(WEEK_SYM)},
|
||||
|
@ -7484,3 +7484,50 @@ ER_UNKNOWN_SEQUENCES 42S02
|
||||
eng "Unknown SEQUENCE: '%-.300s'"
|
||||
ER_UNKNOWN_VIEW 42S02
|
||||
eng "Unknown VIEW: '%-.300s'"
|
||||
|
||||
# MariaDB error numbers related to System Versioning
|
||||
|
||||
ER_SYS_START_NOT_SPECIFIED
|
||||
eng "'Generated as row start' not specified"
|
||||
|
||||
ER_SYS_END_NOT_SPECIFIED
|
||||
eng "'Generated as row end' not specified"
|
||||
|
||||
ER_SYS_START_MORE_THAN_ONCE
|
||||
eng "'Generated as row start' specified more than once"
|
||||
|
||||
ER_SYS_END_MORE_THAN_ONCE
|
||||
eng "Generated as row end specified more than once"
|
||||
|
||||
ER_MISSING_PERIOD_FOR_SYSTEM_TIME
|
||||
eng "'Period for system time' is missing"
|
||||
|
||||
ER_TABLE_DOESNT_SUPPORT_SYSTEM_VERSIONING
|
||||
eng "Table '%s' doesn't support system versioning"
|
||||
|
||||
ER_MISSING_WITH_SYSTEM_VERSIONING
|
||||
eng "'With system versioning' is missing"
|
||||
|
||||
ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_START_COLUMN
|
||||
eng "First column in 'period for system time' must be equal to 'generated as row start' column"
|
||||
|
||||
ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_END_COLUMN
|
||||
eng "Second column in 'period for system time' must be equal to 'generated as row end' column"
|
||||
|
||||
ER_SYS_START_AND_SYS_END_SAME
|
||||
eng "'Period for system_time' must contain two different columns"
|
||||
|
||||
ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER
|
||||
eng "Generated field for System Versioning cannot be set by user"
|
||||
|
||||
ER_FOREIGN_KEY_ON_SYSTEM_VERSIONED
|
||||
eng "Foreign key clause is not yet supported in conjunction with system versioning"
|
||||
|
||||
ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING
|
||||
eng "Rows matched: %ld Changed: %ld Inserted: %ld Warnings: %ld"
|
||||
|
||||
ER_SYS_START_FIELD_MUST_BE_TIMESTAMP
|
||||
eng "System start field must be of type TIMESTAMP"
|
||||
|
||||
ER_SYS_END_FIELD_MUST_BE_TIMESTAMP
|
||||
eng "System end field must be of type TIMESTAMP"
|
||||
|
@ -7071,7 +7071,7 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
|
||||
thd->lex->current_select->is_item_list_lookup= 0;
|
||||
|
||||
/*
|
||||
To prevent fail on forward lookup we fill it with zerows,
|
||||
To prevent fail on forward lookup we fill it with zeroes,
|
||||
then if we got pointer on zero after find_item_in_list we will know
|
||||
that it is forward lookup.
|
||||
|
||||
@ -7962,6 +7962,13 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
|
||||
ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
|
||||
rfield->field_name, table->s->table_name.str);
|
||||
}
|
||||
if (table->versioned() && rfield->is_generated() &&
|
||||
!ignore_errors)
|
||||
{
|
||||
my_error(ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER, MYF(0));
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (rfield->stored_in_db() &&
|
||||
(value->save_in_field(rfield, 0)) < 0 && !ignore_errors)
|
||||
{
|
||||
@ -8002,7 +8009,7 @@ void switch_to_nullable_trigger_fields(List<Item> &items, TABLE *table)
|
||||
Field** field= table->field_to_fill();
|
||||
|
||||
/* True if we have NOT NULL fields and BEFORE triggers */
|
||||
if (field != table->field)
|
||||
if (field != table->field && field != table->non_generated_field)
|
||||
{
|
||||
List_iterator_fast<Item> it(items);
|
||||
Item *item;
|
||||
@ -8209,6 +8216,13 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
|
||||
}
|
||||
}
|
||||
|
||||
if (table->versioned() && field->is_generated() &&
|
||||
!ignore_errors)
|
||||
{
|
||||
my_error(ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER, MYF(0));
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (use_value)
|
||||
value->save_val(field);
|
||||
else
|
||||
@ -8460,7 +8474,6 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
|
||||
{
|
||||
List_iterator<Item_func_match> li(*(select_lex->ftfunc_list));
|
||||
Item_func_match *ifm;
|
||||
DBUG_PRINT("info",("Performing FULLTEXT search"));
|
||||
|
||||
while ((ifm=li++))
|
||||
ifm->init_search(thd, no_order);
|
||||
|
@ -3906,7 +3906,12 @@ public:
|
||||
Lex_input_stream *lip= &m_parser_state->m_lip;
|
||||
if (!yytext)
|
||||
{
|
||||
if (!(yytext= lip->get_tok_start()))
|
||||
if (lip->lookahead_token >= 0)
|
||||
yytext= lip->get_tok_start_prev();
|
||||
else
|
||||
yytext= lip->get_tok_start();
|
||||
|
||||
if (!yytext)
|
||||
yytext= "";
|
||||
}
|
||||
/* Push an error into the error stack */
|
||||
@ -5516,6 +5521,10 @@ class multi_update :public select_result_interceptor
|
||||
|
||||
/* Need this to protect against multiple prepare() calls */
|
||||
bool prepared;
|
||||
|
||||
// For System Versioning (may need to insert new fields to a table).
|
||||
ha_rows updated_sys_ver;
|
||||
|
||||
public:
|
||||
multi_update(THD *thd_arg, TABLE_LIST *ut, List<TABLE_LIST> *leaves_list,
|
||||
List<Item> *fields, List<Item> *values,
|
||||
|
@ -343,7 +343,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
*/
|
||||
if (!with_select && !using_limit && const_cond_result &&
|
||||
(!thd->is_current_stmt_binlog_format_row() &&
|
||||
!(table->triggers && table->triggers->has_delete_triggers())))
|
||||
!(table->triggers && table->triggers->has_delete_triggers()))
|
||||
&& !table->versioned())
|
||||
{
|
||||
/* Update the table->file->stats.records number */
|
||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
@ -559,6 +560,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
while (!(error=info.read_record(&info)) && !thd->killed &&
|
||||
! thd->is_error())
|
||||
{
|
||||
if (table->versioned() &&
|
||||
!table->vers_end_field()->is_max_timestamp())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
explain->tracker.on_record_read();
|
||||
thd->inc_examined_row_count(1);
|
||||
if (table->vfield)
|
||||
@ -580,7 +587,16 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(error= table->file->ha_delete_row(table->record[0])))
|
||||
if (!table->versioned())
|
||||
error= table->file->ha_delete_row(table->record[0]);
|
||||
else
|
||||
{
|
||||
store_record(table,record[1]);
|
||||
table->vers_end_field()->set_time();
|
||||
error= table->file->ha_update_row(table->record[1],
|
||||
table->record[0]);
|
||||
}
|
||||
if (!error)
|
||||
{
|
||||
deleted++;
|
||||
if (table->triggers &&
|
||||
@ -1052,6 +1068,12 @@ int multi_delete::send_data(List<Item> &values)
|
||||
if (table->status & (STATUS_NULL_ROW | STATUS_DELETED))
|
||||
continue;
|
||||
|
||||
if (table->versioned() &&
|
||||
!table->vers_end_field()->is_max_timestamp())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
table->file->position(table->record[0]);
|
||||
found++;
|
||||
|
||||
@ -1064,7 +1086,16 @@ int multi_delete::send_data(List<Item> &values)
|
||||
TRG_ACTION_BEFORE, FALSE))
|
||||
DBUG_RETURN(1);
|
||||
table->status|= STATUS_DELETED;
|
||||
if (!(error=table->file->ha_delete_row(table->record[0])))
|
||||
if (!table->versioned())
|
||||
error= table->file->ha_delete_row(table->record[0]);
|
||||
else
|
||||
{
|
||||
store_record(table,record[1]);
|
||||
table->vers_end_field()->set_time();
|
||||
error= table->file->ha_update_row(table->record[1],
|
||||
table->record[0]);
|
||||
}
|
||||
if (!error)
|
||||
{
|
||||
deleted++;
|
||||
if (!table->file->has_transactions())
|
||||
@ -1243,8 +1274,16 @@ int multi_delete::do_table_deletes(TABLE *table, SORT_INFO *sort_info,
|
||||
local_error= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
local_error= table->file->ha_delete_row(table->record[0]);
|
||||
|
||||
if (!table->versioned())
|
||||
local_error= table->file->ha_delete_row(table->record[0]);
|
||||
else
|
||||
{
|
||||
store_record(table,record[1]);
|
||||
table->vers_end_field()->set_time();
|
||||
local_error= table->file->ha_update_row(table->record[1],
|
||||
table->record[0]);
|
||||
}
|
||||
if (local_error && !ignore)
|
||||
{
|
||||
table->file->print_error(local_error, MYF(0));
|
||||
|
@ -222,7 +222,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
|
||||
table_list->view_db.str, table_list->view_name.str);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (values.elements != table->s->fields)
|
||||
if (values.elements != table->user_fields())
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
|
||||
DBUG_RETURN(-1);
|
||||
@ -1029,6 +1029,13 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
}
|
||||
}
|
||||
|
||||
if (table->versioned() &&
|
||||
table->vers_update_fields())
|
||||
{
|
||||
error= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((res= table_list->view_check_option(thd,
|
||||
(values_list.elements == 1 ?
|
||||
0 :
|
||||
@ -1555,6 +1562,13 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
|
||||
if (!table)
|
||||
table= table_list->table;
|
||||
|
||||
if (table->versioned() && duplic == DUP_REPLACE)
|
||||
{
|
||||
// Additional memory may be required to create historical items.
|
||||
if (table_list->set_insert_values(thd->mem_root))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (!select_insert)
|
||||
{
|
||||
Item *fake_conds= 0;
|
||||
@ -1605,6 +1619,31 @@ static int last_uniq_key(TABLE *table,uint keynr)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Inserts one historical row to a table.
|
||||
|
||||
Copies content of the row from table->record[1] to table->record[0],
|
||||
sets Sys_end to now() and calls ha_write_row() .
|
||||
*/
|
||||
|
||||
int vers_insert_history_row(TABLE *table, ha_rows *inserted)
|
||||
{
|
||||
DBUG_ASSERT(table->versioned());
|
||||
restore_record(table,record[1]);
|
||||
|
||||
// Set Sys_end to now()
|
||||
if (table->vers_end_field()->set_time())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
const int error= table->file->ha_write_row(table->record[0]);
|
||||
if (!error)
|
||||
++*inserted;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
Write a record to table with optional deleting of conflicting records,
|
||||
invoke proper triggers if needed.
|
||||
@ -1809,7 +1848,12 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
}
|
||||
|
||||
if (error != HA_ERR_RECORD_IS_THE_SAME)
|
||||
{
|
||||
info->updated++;
|
||||
if (table->versioned() &&
|
||||
(error=vers_insert_history_row(table, &info->copied)))
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
error= 0;
|
||||
/*
|
||||
@ -1861,13 +1905,16 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
tables which have ON UPDATE but have no ON DELETE triggers,
|
||||
we just should not expose this fact to users by invoking
|
||||
ON UPDATE triggers.
|
||||
*/
|
||||
if (last_uniq_key(table,key_nr) &&
|
||||
!table->file->referenced_by_foreign_key() &&
|
||||
(!table->triggers || !table->triggers->has_delete_triggers()))
|
||||
For system versioning wa also use path through delete since we would
|
||||
save nothing through this cheating.
|
||||
*/
|
||||
if (last_uniq_key(table,key_nr) &&
|
||||
!table->file->referenced_by_foreign_key() &&
|
||||
(!table->triggers || !table->triggers->has_delete_triggers()) &&
|
||||
!table->versioned())
|
||||
{
|
||||
if ((error=table->file->ha_update_row(table->record[1],
|
||||
table->record[0])) &&
|
||||
table->record[0])) &&
|
||||
error != HA_ERR_RECORD_IS_THE_SAME)
|
||||
goto err;
|
||||
if (error != HA_ERR_RECORD_IS_THE_SAME)
|
||||
@ -1887,9 +1934,29 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
||||
TRG_ACTION_BEFORE, TRUE))
|
||||
goto before_trg_err;
|
||||
if ((error=table->file->ha_delete_row(table->record[1])))
|
||||
|
||||
if (!table->versioned())
|
||||
error= table->file->ha_delete_row(table->record[1]);
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(table->insert_values);
|
||||
store_record(table,insert_values);
|
||||
restore_record(table,record[1]);
|
||||
if (table->vers_end_field()->set_time())
|
||||
{
|
||||
error= 1;
|
||||
goto err;
|
||||
}
|
||||
error= table->file->ha_update_row(table->record[1],
|
||||
table->record[0]);
|
||||
restore_record(table,insert_values);
|
||||
}
|
||||
if (error)
|
||||
goto err;
|
||||
info->deleted++;
|
||||
if (!table->versioned())
|
||||
info->deleted++;
|
||||
else
|
||||
info->updated++;
|
||||
if (!table->file->has_transactions())
|
||||
thd->transaction.stmt.modified_non_trans_table= TRUE;
|
||||
if (table->triggers &&
|
||||
@ -3732,6 +3799,9 @@ int select_insert::send_data(List<Item> &values)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
thd->count_cuted_fields= CHECK_FIELD_WARN; // Calculate cuted fields
|
||||
if (table->versioned() &&
|
||||
table->vers_update_fields())
|
||||
DBUG_RETURN(1);
|
||||
store_values(values);
|
||||
if (table->default_field && table->update_default_fields(0, info.ignore))
|
||||
DBUG_RETURN(1);
|
||||
@ -3793,12 +3863,16 @@ int select_insert::send_data(List<Item> &values)
|
||||
|
||||
void select_insert::store_values(List<Item> &values)
|
||||
{
|
||||
DBUG_ENTER("select_insert::store_values");
|
||||
|
||||
if (fields->elements)
|
||||
fill_record_n_invoke_before_triggers(thd, table, *fields, values, 1,
|
||||
TRG_EVENT_INSERT);
|
||||
else
|
||||
fill_record_n_invoke_before_triggers(thd, table, table->field_to_fill(),
|
||||
values, 1, TRG_EVENT_INSERT);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
bool select_insert::prepare_eof()
|
||||
|
@ -37,6 +37,7 @@ void upgrade_lock_type_for_insert(THD *thd, thr_lock_type *lock_type,
|
||||
bool is_multi_insert);
|
||||
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
|
||||
TABLE_LIST *table_list);
|
||||
int vers_insert_history_row(TABLE *table, ha_rows *inserted);
|
||||
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
|
||||
void kill_delayed_threads(void);
|
||||
|
||||
|
@ -1343,6 +1343,27 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd)
|
||||
return WITH;
|
||||
}
|
||||
break;
|
||||
case FOR_SYM:
|
||||
/*
|
||||
* Additional look-ahead to resolve doubtful cases like:
|
||||
* SELECT ... FOR UPDATE
|
||||
* SELECT ... FOR SYSTEM_TIME ... .
|
||||
*/
|
||||
token= lex_one_token(yylval, thd);
|
||||
lip->add_digest_token(token, yylval);
|
||||
switch(token) {
|
||||
case SYSTEM_TIME_SYM:
|
||||
return FOR_SYSTEM_TIME_SYM;
|
||||
default:
|
||||
/*
|
||||
Save the token following 'FOR_SYM'
|
||||
*/
|
||||
lip->lookahead_yylval= lip->yylval;
|
||||
lip->yylval= NULL;
|
||||
lip->lookahead_token= token;
|
||||
return FOR_SYM;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2998,8 +3019,7 @@ void Query_tables_list::destroy_query_tables_list()
|
||||
*/
|
||||
|
||||
LEX::LEX()
|
||||
: explain(NULL),
|
||||
result(0), arena_for_set_stmt(0), mem_root_for_set_stmt(0),
|
||||
: explain(NULL), result(0), arena_for_set_stmt(0), mem_root_for_set_stmt(0),
|
||||
option_type(OPT_DEFAULT), context_analysis_only(0), sphead(0),
|
||||
is_lex_started(0), limit_rows_examined_cnt(ULONGLONG_MAX)
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user