mirror of
https://github.com/MariaDB/server.git
synced 2025-11-10 23:02:54 +03:00
MDEV-11953: support of brackets in UNION/EXCEPT/INTERSECT operations
This commit is contained in:
@@ -195,6 +195,8 @@ a
|
||||
2
|
||||
1
|
||||
select row_start from t where a=3 into @tm;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
alter table t add column b int;
|
||||
select @tm=row_start from t where a=3;
|
||||
@tm=row_start
|
||||
|
||||
@@ -10,6 +10,8 @@ insert into t1 values ();
|
||||
set @ts0= now(6);
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx0;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select transaction_id = @tx0 from mysql.transaction_registry
|
||||
order by transaction_id desc limit 1;
|
||||
transaction_id = @tx0
|
||||
@@ -17,6 +19,8 @@ transaction_id = @tx0
|
||||
set @ts1= now(6);
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx1;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select transaction_id = @tx1 from mysql.transaction_registry
|
||||
order by transaction_id desc limit 1;
|
||||
transaction_id = @tx1
|
||||
@@ -24,6 +28,8 @@ transaction_id = @tx1
|
||||
set @ts2= now(6);
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx2;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select transaction_id = @tx2 from mysql.transaction_registry
|
||||
order by transaction_id desc limit 1;
|
||||
transaction_id = @tx2
|
||||
@@ -66,24 +72,32 @@ trt_trx_sees(0, @tx2)
|
||||
set transaction isolation level read uncommitted;
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx3;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3;
|
||||
isolation_level = 'READ-UNCOMMITTED'
|
||||
1
|
||||
set transaction isolation level read committed;
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx4;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4;
|
||||
isolation_level = 'READ-COMMITTED'
|
||||
1
|
||||
set transaction isolation level serializable;
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx5;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5;
|
||||
isolation_level = 'SERIALIZABLE'
|
||||
1
|
||||
set transaction isolation level repeatable read;
|
||||
insert into t1 values ();
|
||||
select sys_trx_start from t1 where id = last_insert_id() into @tx6;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6;
|
||||
isolation_level = 'REPEATABLE-READ'
|
||||
1
|
||||
|
||||
@@ -273,8 +273,12 @@ t3 CREATE TABLE `t3` (
|
||||
## For versioned table
|
||||
insert into t1 values (1);
|
||||
select row_start from t1 into @row_start;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
insert into t0 (y) values (2);
|
||||
select st from t0 into @st;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
create or replace table t2 with system versioning as select * from t1;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
@@ -337,8 +341,12 @@ ERROR 42S21: Duplicate column name 'row_end'
|
||||
# Prepare checking for historical row
|
||||
delete from t1;
|
||||
select row_end from t1 for system_time all into @row_end;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
delete from t0;
|
||||
select en from t0 for system_time all into @en;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
## Combinations of versioned + non-versioned
|
||||
create or replace table t2 (y int);
|
||||
insert into t2 values (3);
|
||||
@@ -359,10 +367,14 @@ insert into t2 (y) values (1), (2);
|
||||
delete from t2 where y = 2;
|
||||
create or replace table t3 select * from t2 for system_time all;
|
||||
select st, en from t3 where y = 1 into @st, @en;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select y from t2 for system_time all where st = @st and en = @en;
|
||||
y
|
||||
1
|
||||
select st, en from t3 where y = 2 into @st, @en;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select y from t2 for system_time all where st = @st and en = @en;
|
||||
y
|
||||
2
|
||||
|
||||
@@ -266,6 +266,8 @@ on update cascade
|
||||
) engine=innodb;
|
||||
insert into parent (value) values (23);
|
||||
select id, value from parent into @id, @value;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
insert into child values (default, @id, @value);
|
||||
insert into subchild values (default, @id, @value);
|
||||
select parent_id from subchild;
|
||||
|
||||
@@ -54,6 +54,8 @@ drop view vt1_1;
|
||||
create or replace table t1( id bigint primary key, a int, b int) with system versioning;
|
||||
insert into t1 values(1, 1, 1);
|
||||
select row_start, row_end from t1 into @sys_start, @sys_end;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select id, a, b from t1;
|
||||
id a b
|
||||
1 1 1
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING;
|
||||
INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3);
|
||||
SELECT a, b, c FROM t1 INTO OUTFILE '15330.data';
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
LOAD DATA INFILE '15330.data' IGNORE INTO TABLE t1 (a,b,c);
|
||||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'a'
|
||||
|
||||
@@ -139,6 +139,8 @@ x C D
|
||||
1 1 1
|
||||
set @str= concat('select row_start from t1 partition (pn) into @ts0');
|
||||
prepare stmt from @str;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
execute stmt;
|
||||
drop prepare stmt;
|
||||
set @now= now(6);
|
||||
@@ -150,6 +152,8 @@ execute select_pn;
|
||||
x C D
|
||||
set @str= concat('select row_start from t1 partition (p0) into @ts1');
|
||||
prepare stmt from @str;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
execute stmt;
|
||||
drop prepare stmt;
|
||||
select @ts0 = @ts1;
|
||||
@@ -165,6 +169,8 @@ x C D
|
||||
2 1 1
|
||||
set @str= concat('select row_start from t1 partition (pn) into @ts0');
|
||||
prepare stmt from @str;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
execute stmt;
|
||||
drop prepare stmt;
|
||||
set @now= now(6);
|
||||
@@ -180,14 +186,20 @@ drop prepare select_p0;
|
||||
drop prepare select_pn;
|
||||
set @str= concat('select row_start from t1 partition (p0) where x = 2 into @ts1');
|
||||
prepare stmt from @str;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
execute stmt;
|
||||
drop prepare stmt;
|
||||
set @str= concat('select row_end from t1 partition (p0) where x = 2 into @ts2');
|
||||
prepare stmt from @str;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
execute stmt;
|
||||
drop prepare stmt;
|
||||
set @str= concat('select row_start from t1 partition (pn) into @ts3');
|
||||
prepare stmt from @str;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
execute stmt;
|
||||
drop prepare stmt;
|
||||
select @ts0 = @ts1;
|
||||
@@ -349,6 +361,8 @@ create or replace table t2 (f int);
|
||||
create or replace trigger tr before insert on t2
|
||||
for each row select table_rows from information_schema.tables
|
||||
where table_name = 't1' into @a;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
insert into t2 values (1);
|
||||
# MDEV-14740 Locking assertion for system_time partitioning
|
||||
create or replace table t1 (i int) with system versioning
|
||||
@@ -358,6 +372,8 @@ partition pn current);
|
||||
create or replace table t2 (f int);
|
||||
create or replace trigger tr before insert on t2
|
||||
for each row select count(*) from t1 into @a;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
insert into t2 values (1);
|
||||
# MDEV-14741 Assertion `(trx)->start_file == 0' failed in row_truncate_table_for_mysql()
|
||||
create or replace table t1 (i int) with system versioning
|
||||
|
||||
11
mysql-test/suite/versioning/r/select,trx_id.rdiff
Normal file
11
mysql-test/suite/versioning/r/select,trx_id.rdiff
Normal file
@@ -0,0 +1,11 @@
|
||||
--- select.result 2018-06-29 18:09:17.962447067 +0200
|
||||
+++ select.reject 2018-06-29 18:10:04.618808616 +0200
|
||||
@@ -17,6 +17,8 @@
|
||||
(8, 108),
|
||||
(9, 109);
|
||||
set @t0= now(6);
|
||||
+Warnings:
|
||||
+Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
delete from t1 where x = 3;
|
||||
delete from t1 where x > 7;
|
||||
insert into t1(x, y) values(3, 33);
|
||||
@@ -21,6 +21,8 @@ delete from t1 where x = 3;
|
||||
delete from t1 where x > 7;
|
||||
insert into t1(x, y) values(3, 33);
|
||||
select sys_trx_start from t1 where x = 3 and y = 33 into @t1;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select x, y from t1;
|
||||
x y
|
||||
0 100
|
||||
@@ -330,6 +332,8 @@ insert into t1 values (1);
|
||||
set @ts= now(6);
|
||||
delete from t1;
|
||||
select sys_trx_start from t1 for system_time all into @trx_start;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
## ensure @trx_start is much lower than unix timestamp
|
||||
select @trx_start < unix_timestamp(@ts) - 100 as trx_start_good;
|
||||
trx_start_good
|
||||
@@ -526,7 +530,11 @@ period for system_time (row_start, row_end)
|
||||
insert into t1 values (1);
|
||||
delete from t1;
|
||||
select row_start from t1 for system_time all into @t1;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select row_end from t1 for system_time all into @t2;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select * from t1 for system_time between @t1 and @t2;
|
||||
a
|
||||
1
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- select2.result
|
||||
+++ select2,trx_id.result~
|
||||
@@ -22,6 +22,8 @@
|
||||
delete from t1 where x > 7;
|
||||
insert into t1(x, y) values(3, 33);
|
||||
--- select2.result 2018-06-29 17:51:17.142172085 +0200
|
||||
+++ select2,trx_id.reject 2018-06-29 18:03:49.034273090 +0200
|
||||
@@ -26,6 +26,8 @@
|
||||
select sys_start from t1 where x = 3 and y = 33 into @t1;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
+set @x1= @t1;
|
||||
+select trt_commit_ts(@x1) into @t1;
|
||||
select x, y from t1;
|
||||
x y
|
||||
0 100
|
||||
@@ -82,7 +84,7 @@
|
||||
@@ -86,7 +88,7 @@
|
||||
8 108
|
||||
9 109
|
||||
3 33
|
||||
@@ -18,7 +18,7 @@
|
||||
ASOF2_x y
|
||||
0 100
|
||||
1 101
|
||||
@@ -94,7 +96,7 @@
|
||||
@@ -98,7 +100,7 @@
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
@@ -27,7 +27,7 @@
|
||||
FROMTO2_x y
|
||||
0 100
|
||||
1 101
|
||||
@@ -106,7 +108,7 @@
|
||||
@@ -110,7 +112,7 @@
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
|
||||
@@ -18,10 +18,14 @@ insert into t1 (x, y) values
|
||||
(9, 109);
|
||||
set @t0= now(6);
|
||||
select sys_start from t1 limit 1 into @x0;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
delete from t1 where x = 3;
|
||||
delete from t1 where x > 7;
|
||||
insert into t1(x, y) values(3, 33);
|
||||
select sys_start from t1 where x = 3 and y = 33 into @t1;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select x, y from t1;
|
||||
x y
|
||||
0 100
|
||||
@@ -331,7 +335,7 @@ x y
|
||||
select * from (select * from t1 for system_time all, t2 for system_time all) for system_time all as t;
|
||||
ERROR HY000: Table `t` is not system-versioned
|
||||
select * from (t1 for system_time all join t2 for system_time all) for system_time all;
|
||||
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 '' 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 'system_time all' at line 1
|
||||
# MDEV-16043 Assertion thd->Item_change_list::is_empty() failed in mysql_parse upon SELECT from a view reading from a versioned table
|
||||
create or replace table t1 (a int) with system versioning;
|
||||
create or replace view v1 as select * from t1;
|
||||
|
||||
@@ -17,11 +17,15 @@ add period for system_time(s, e),
|
||||
add system versioning,
|
||||
algorithm=inplace;
|
||||
select s from t1 into @trx_start;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start;
|
||||
count(*) = 1
|
||||
1
|
||||
create or replace table t1 (x int);
|
||||
select count(*) from mysql.transaction_registry into @tmp;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
alter table t1
|
||||
add column s bigint unsigned as row start,
|
||||
add column e bigint unsigned as row end,
|
||||
@@ -40,11 +44,15 @@ add period for system_time(s, e),
|
||||
add system versioning,
|
||||
algorithm=copy;
|
||||
select s from t1 into @trx_start;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start;
|
||||
count(*) = 1
|
||||
1
|
||||
create or replace table t1 (x int);
|
||||
select count(*) from mysql.transaction_registry into @tmp;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
alter table t1
|
||||
add column s bigint unsigned as row start,
|
||||
add column e bigint unsigned as row end,
|
||||
@@ -96,8 +104,14 @@ set @ts2= sysdate(6);
|
||||
commit;
|
||||
set @ts3= sysdate(6);
|
||||
select sys_start from t1 where x = 1 into @trx_id1;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select sys_start from t1 where x = 2 into @trx_id2;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select sys_start from t1 where x = 3 into @trx_id3;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select @trx_id1 < @trx_id2, @trx_id2 < @trx_id3;
|
||||
@trx_id1 < @trx_id2 @trx_id2 < @trx_id3
|
||||
1 1
|
||||
@@ -178,6 +192,8 @@ set @ts1= now(6);
|
||||
insert into t1 values (1);
|
||||
commit;
|
||||
select row_start from t1 into @trx_id;
|
||||
Warnings:
|
||||
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||
select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD;
|
||||
BEGIN_TS_GOOD
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user