1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-15413 Unexpected errors upon CREATE TABLE .. WITH SYSTEM VERSIONING AS SELECT ...

numerous fixes for CREATE ... SELECT with system versioning:
In CREATE ... SELECT the table is created based on the result set,
field properties do not count. That is
* field invisibility is *not* copied over
* AS ROW START/END is *not* copied over
* the history is *not* copied over
* system row_start/row_end fields can *not* be created from the SELECT part
This commit is contained in:
Sergei Golubchik
2018-04-02 19:35:27 +02:00
parent 72dd813f7e
commit 9bd3af97df
10 changed files with 114 additions and 191 deletions

View File

@ -247,9 +247,9 @@ create or replace table t3 with system versioning select x23 from t1;
--replace_result $default_engine DEFAULT_ENGINE
show create table t3;
select * from t3;
--error ER_MISSING
--error ER_DUP_FIELDNAME
create or replace table t3 with system versioning select x23, row_start from t1;
--error ER_MISSING
--error ER_DUP_FIELDNAME
create or replace table t3 with system versioning select x23, row_end from t1;
--echo # Prepare checking for historical row
@ -286,8 +286,8 @@ as select x25, row_start, row_end from t1 for system_time all;
show create table t2;
create or replace table t2 with system versioning
as select x25, row_start, row_end from t1;
--replace_result $non_default_engine NON_DEFAULT_ENGINE
as select x25, row_start rs, row_end re from t1;
--replace_result $default_engine DEFAULT_ENGINE
show create table t2;
create or replace table t1 (
@ -296,16 +296,16 @@ create or replace table t1 (
en bigint unsigned as row end,
period for system_time (st, en)
) with system versioning engine innodb;
--error ER_VERS_FIELD_WRONG_TYPE
create or replace table t2 with system versioning engine myisam
as select * from t1;
show create table t2;
--replace_result $non_default_engine NON_DEFAULT_ENGINE
eval create or replace table t1 (x27 int, id int) with system versioning engine $non_default_engine;
create or replace table t2 (b int, id int);
create or replace table t3 with system versioning
as select t2.b, t1.x27, t1.row_start, t1.row_end from t2 inner join t1 on t2.id=t1.id;
--replace_result $non_default_engine NON_DEFAULT_ENGINE
as select t2.b, t1.x27, t1.row_start rs, t1.row_end re from t2 inner join t1 on t2.id=t1.id;
--replace_result $default_engine DEFAULT_ENGINE
show create table t3;
--echo ## Errors
@ -363,5 +363,13 @@ prepare bad from 'create or replace table t2 with system versioning as select *
execute bad; execute bad; execute bad; execute bad; execute bad; execute bad; execute bad; execute bad;
--echo # bad is good.
--echo # MDEV-15413 Unexpected errors upon CREATE TABLE .. WITH SYSTEM VERSIONING AS SELECT ...
create or replace table t1 with system versioning as select 1 as i;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
create or replace table t1 (i int) with system versioning as select 1 as i;
--replace_result $default_engine DEFAULT_ENGINE
show create table t1;
drop database test;
create database test;