mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
SQL: table with duplicate ROW START/END columns [fixes #369]
This commit is contained in:
committed by
Aleksey Midenkov
parent
84b718ae70
commit
03b54a6b8a
@ -37,11 +37,10 @@ t1 CREATE TABLE `t1` (
|
||||
create or replace table t1 (
|
||||
x3 int unsigned,
|
||||
Sys_start SYS_TRX_TYPE generated always as row start,
|
||||
Sys_start2 SYS_TRX_TYPE generated always as row start,
|
||||
Sys_end SYS_TRX_TYPE generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
period for system_time (x, Sys_end)
|
||||
) with system versioning;
|
||||
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `Sys_start2` and `Sys_end`
|
||||
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `Sys_start` and `Sys_end`
|
||||
create or replace table t1 (
|
||||
x4 int unsigned,
|
||||
Sys_start SYS_TRX_TYPE generated always as row start,
|
||||
@ -53,10 +52,9 @@ create or replace table t1 (
|
||||
x5 int unsigned,
|
||||
Sys_start SYS_TRX_TYPE generated always as row start,
|
||||
Sys_end SYS_TRX_TYPE generated always as row end,
|
||||
Sys_end2 SYS_TRX_TYPE generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
period for system_time (Sys_start, x)
|
||||
) with system versioning;
|
||||
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `Sys_start` and `Sys_end2`
|
||||
ERROR HY000: PERIOD FOR SYSTEM_TIME must use columns `Sys_start` and `Sys_end`
|
||||
create or replace table t1 (
|
||||
x6 int unsigned,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
@ -66,7 +64,6 @@ create or replace table t1 (
|
||||
x7 int unsigned,
|
||||
Sys_start SYS_TRX_TYPE generated always as row start,
|
||||
Sys_end SYS_TRX_TYPE generated always as row end,
|
||||
Sys_end2 SYS_TRX_TYPE generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
);
|
||||
ERROR HY000: Wrong parameters for `t1`: missing 'WITH SYSTEM VERSIONING'
|
||||
@ -302,5 +299,13 @@ alter table t with system versioning;
|
||||
ERROR 42S21: Duplicate column name 'sys_trx_end'
|
||||
create or replace temporary table t (x int) with system versioning;
|
||||
ERROR HY000: Incorrect usage of TEMPORARY and WITH SYSTEM VERSIONING
|
||||
create or replace table t1 (
|
||||
x11 int unsigned,
|
||||
Sys_start0 timestamp(6) generated always as row start,
|
||||
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;
|
||||
ERROR HY000: Duplicate ROW START column `Sys_start`
|
||||
drop database test;
|
||||
create database test;
|
||||
|
@ -43,9 +43,8 @@ show create table t1;
|
||||
eval create or replace table t1 (
|
||||
x3 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_start2 $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
period for system_time (x, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
@ -63,8 +62,7 @@ eval create or replace table t1 (
|
||||
x5 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
Sys_end2 $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
period for system_time (Sys_start, x)
|
||||
) with system versioning;
|
||||
|
||||
--error ER_MISSING
|
||||
@ -79,7 +77,6 @@ eval create or replace table t1 (
|
||||
x7 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
Sys_end2 $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
);
|
||||
|
||||
@ -289,5 +286,14 @@ alter table t with system versioning;
|
||||
--error ER_WRONG_USAGE
|
||||
create or replace temporary table t (x int) with system versioning;
|
||||
|
||||
--error ER_VERS_DUPLICATE_ROW_START_END
|
||||
create or replace table t1 (
|
||||
x11 int unsigned,
|
||||
Sys_start0 timestamp(6) generated always as row start,
|
||||
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;
|
||||
|
||||
drop database test;
|
||||
create database test;
|
||||
|
@ -7914,3 +7914,5 @@ ER_VERS_GENERATED_ALWAYS_NOT_EMPTY
|
||||
ER_VERS_TRT_IS_DISABLED
|
||||
eng "Some versioned DML requires `transaction_registry` to be set to ON."
|
||||
|
||||
ER_VERS_DUPLICATE_ROW_START_END
|
||||
eng "Duplicate ROW %s column %`s"
|
||||
|
@ -6404,10 +6404,20 @@ field_def:
|
||||
{
|
||||
case 1:
|
||||
p= &info.as_row.start;
|
||||
if (*p)
|
||||
{
|
||||
my_yyabort_error((ER_VERS_DUPLICATE_ROW_START_END, MYF(0),
|
||||
"START", field_name.str));
|
||||
}
|
||||
lex->last_field->flags|= VERS_SYS_START_FLAG;
|
||||
break;
|
||||
case 0:
|
||||
p= &info.as_row.end;
|
||||
if (*p)
|
||||
{
|
||||
my_yyabort_error((ER_VERS_DUPLICATE_ROW_START_END, MYF(0),
|
||||
"END", field_name.str));
|
||||
}
|
||||
lex->last_field->flags|= VERS_SYS_END_FLAG;
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user