mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
First, we do not add VERS_UPDATE_UNVERSIONED_FLAG for system field and that fixes SHOW CREATE result. Second, we have to call check_sys_fields() for any CREATE TABLE and there correct type is checked for system fields. Third, we update system_time like as_row structures for ALTER TABLE and that makes check_sys_fields() happy for ALTER TABLE when we make system fields hidden.
This commit is contained in:
@ -619,8 +619,32 @@ Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`x` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
|
||||
`y` int(11) DEFAULT NULL,
|
||||
`row_start` timestamp(6) GENERATED ALWAYS AS ROW START WITHOUT SYSTEM VERSIONING,
|
||||
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END WITHOUT SYSTEM VERSIONING,
|
||||
`row_start` timestamp(6) GENERATED ALWAYS AS ROW START,
|
||||
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
|
||||
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
|
||||
#
|
||||
create or replace table t (
|
||||
a int,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e))
|
||||
with system versioning;
|
||||
ERROR HY000: `s` must be of type TIMESTAMP(6) for system-versioned table `t`
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e));
|
||||
ERROR HY000: `s` must be of type TIMESTAMP(6) for system-versioned table `t`
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
b int with system versioning,
|
||||
s timestamp(6) as row start,
|
||||
e timestamp(6) as row end,
|
||||
period for system_time (s, e));
|
||||
insert into t () values (),();
|
||||
drop table t;
|
||||
|
@ -468,3 +468,32 @@ create or replace table t1 (
|
||||
show create table t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
|
||||
--echo #
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t (
|
||||
a int,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e))
|
||||
with system versioning;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e));
|
||||
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
b int with system versioning,
|
||||
s timestamp(6) as row start,
|
||||
e timestamp(6) as row end,
|
||||
period for system_time (s, e));
|
||||
insert into t () values (),();
|
||||
|
||||
# cleanup
|
||||
drop table t;
|
||||
|
Reference in New Issue
Block a user