Skip to content

Commit

Permalink
SQL: redundant error codes reduced
Browse files Browse the repository at this point in the history
Replaced codes:

ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
ER_MISSING_WITH_SYSTEM_VERSIONING
ER_SYS_START_NOT_SPECIFIED
ER_SYS_END_NOT_SPECIFIED
ER_MISSING_PERIOD_FOR_SYSTEM_TIME
ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_START_COLUMN
ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_END_COLUMN
ER_SYS_START_AND_SYS_END_SAME
ER_SYS_START_MORE_THAN_ONCE
ER_SYS_END_MORE_THAN_ONCE

with:

ER_VERS_WRONG_PARAMS
ER_VERS_FIELD_WRONG_TYPE
  • Loading branch information
midenok committed May 5, 2017
1 parent 52a6812 commit 303d72a
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 151 deletions.
32 changes: 16 additions & 16 deletions mysql-test/suite/versioning/r/create.result
Original file line number Diff line number Diff line change
Expand Up @@ -32,91 +32,91 @@ 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
ERROR HY000: Wrong parameters for versioned table `t1`: multiple 'GENERATED ALWAYS AS ROW START'
create or replace 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
ERROR HY000: Wrong parameters for versioned table `t1`: 'PERIOD FOR SYSTEM_TIME' and 'GENERATED AS ROW END' mismatch
create or replace 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
ERROR HY000: Wrong parameters for versioned table `t1`: multiple 'GENERATED ALWAYS AS ROW END'
create or replace table t1 (
XNo int unsigned,
period for system_time (Sys_start, Sys_end)
) with system versioning;
ERROR HY000: 'Generated as row start' not specified
ERROR HY000: Wrong parameters for versioned table `t1`: 'GENERATED AS ROW START' column missing
create or replace 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
ERROR HY000: Wrong parameters for versioned table `t1`: multiple 'GENERATED ALWAYS AS ROW END'
create or replace 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
ERROR HY000: Wrong parameters for versioned table `t1`: 'PERIOD FOR SYSTEM_TIME' and 'GENERATED AS ROW START' mismatch
create or replace 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
ERROR HY000: Wrong parameters for versioned table `t1`: 'WITH SYSTEM VERSIONING' missing
create or replace 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
ERROR HY000: Wrong parameters for versioned table `t1`: 'PERIOD FOR SYSTEM_TIME' columns must be different
create or replace 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
ERROR HY000: `Sys_start` must be of type `TIMESTAMP` for versioned table `t1`
create or replace 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
ERROR HY000: `Sys_end` must be of type `TIMESTAMP` for versioned table `t1`
create or replace table t1 (
XNo int unsigned,
Sys_start timestamp(6) generated always as row start,
Sys_end bigint generated always as row end,
period for system_time (Sys_start, Sys_end)
) with system versioning engine innodb;
ERROR HY000: System start field must be of type BIGINT UNSIGNED
ERROR HY000: `Sys_start` must be of type `BIGINT UNSIGNED` for versioned table `t1`
create or replace table t1 (
XNo int unsigned,
Sys_start bigint generated always as row start,
Sys_end bigint generated always as row end,
period for system_time (Sys_start, Sys_end)
) with system versioning engine innodb;
ERROR HY000: System start field must be of type BIGINT UNSIGNED
ERROR HY000: `Sys_start` must be of type `BIGINT UNSIGNED` for versioned table `t1`
create or replace table t1 (
XNo int unsigned,
Sys_start bigint unsigned generated always as row start,
Sys_end bigint generated always as row end,
period for system_time (Sys_start, Sys_end)
) with system versioning engine innodb;
ERROR HY000: System end field must be of type BIGINT UNSIGNED
ERROR HY000: `Sys_end` must be of type `BIGINT UNSIGNED` for versioned table `t1`
create or replace table t1 (
A int with system versioning,
B int
Expand Down Expand Up @@ -147,7 +147,7 @@ create or replace table t1 (
A int,
B int without system versioning
);
ERROR HY000: Every field specified unversioned in versioned table
ERROR HY000: Wrong parameters for versioned table `t1`: 'WITH SYSTEM VERSIONING' missing
create or replace table t1 (
A int,
B int without system versioning
Expand Down Expand Up @@ -190,9 +190,9 @@ t1 CREATE TABLE `t1` (
create or replace table t1 (
A int without system versioning
);
ERROR HY000: Every field specified unversioned in versioned table
ERROR HY000: Wrong parameters for versioned table `t1`: 'WITH SYSTEM VERSIONING' missing
create or replace table t1 (
A int without system versioning
) with system versioning;
ERROR HY000: Every field specified unversioned in versioned table
ERROR HY000: Wrong parameters for versioned table `t1`: versioned fields missing
drop table t1;
20 changes: 10 additions & 10 deletions mysql-test/suite/versioning/r/optimized_fields.result
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,50 @@ a b b+0
1 NULL NULL
3 NULL NULL
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select * from t for system_time as of timestamp now(6);
a b
1 NULL
3 NULL
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select count(*) from t group by b for system_time as of timestamp now(6);
count(*)
2
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select * from t for system_time as of timestamp now(6) order by b asc;
a b
1 NULL
3 NULL
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select * from t for system_time as of timestamp now(6) order by b desc;
a b
1 NULL
3 NULL
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select * from t group by a having a=2 for system_time as of timestamp now(6);
a b
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select * from t group by b having b=2 for system_time as of timestamp now(6);
a b
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select a from t where b=2 for system_time as of timestamp now(6);
a
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select a from t where b=NULL for system_time as of timestamp now(6);
a
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
count(*) b
Warnings:
Warning 4067 Attempt to read unversioned field 'b' in historical query
Warning 4055 Attempt to read unversioned field 'b' in historical query
select a, b from t;
a b
1 2
Expand Down
32 changes: 16 additions & 16 deletions mysql-test/suite/versioning/t/create.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ create or replace table t1 (
) with system versioning;
show create table t1;

--error ER_SYS_START_MORE_THAN_ONCE
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
XNo int unsigned,
Sys_start timestamp(6) generated always as row start,
Expand All @@ -27,15 +27,15 @@ create or replace table t1 (
period for system_time (Sys_start, Sys_end)
) with system versioning;

--error ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_END_COLUMN
--error ER_VERS_WRONG_PARAMS
create or replace 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
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
XNo int unsigned,
Sys_start timestamp(6) generated always as row start,
Expand All @@ -44,13 +44,13 @@ create or replace table t1 (
period for system_time (Sys_start, Sys_end)
) with system versioning;

--error ER_SYS_START_NOT_SPECIFIED
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
XNo int unsigned,
period for system_time (Sys_start, Sys_end)
) with system versioning;

--error ER_SYS_END_MORE_THAN_ONCE
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
XNo int unsigned,
Sys_start timestamp(6) generated always as row start,
Expand All @@ -59,63 +59,63 @@ create or replace table t1 (
period for system_time (Sys_start, Sys_end)
);

--error ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_START_COLUMN
--error ER_VERS_WRONG_PARAMS
create or replace 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
--error ER_VERS_WRONG_PARAMS
create or replace 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
--error ER_VERS_WRONG_PARAMS
create or replace 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
--error ER_VERS_FIELD_WRONG_TYPE
create or replace 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
--error ER_VERS_FIELD_WRONG_TYPE
create or replace 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 ER_SYS_START_FIELD_MUST_BE_BIGINT
--error ER_VERS_FIELD_WRONG_TYPE
create or replace table t1 (
XNo int unsigned,
Sys_start timestamp(6) generated always as row start,
Sys_end bigint generated always as row end,
period for system_time (Sys_start, Sys_end)
) with system versioning engine innodb;

--error ER_SYS_START_FIELD_MUST_BE_BIGINT
--error ER_VERS_FIELD_WRONG_TYPE
create or replace table t1 (
XNo int unsigned,
Sys_start bigint generated always as row start,
Sys_end bigint generated always as row end,
period for system_time (Sys_start, Sys_end)
) with system versioning engine innodb;

--error ER_SYS_END_FIELD_MUST_BE_BIGINT
--error ER_VERS_FIELD_WRONG_TYPE
create or replace table t1 (
XNo int unsigned,
Sys_start bigint unsigned generated always as row start,
Expand All @@ -135,7 +135,7 @@ create or replace table t1 (
) with system versioning;
show create table t1;

--error ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
A int,
B int without system versioning
Expand All @@ -159,12 +159,12 @@ create or replace table t1 (
) with system versioning;
show create table t1;

--error ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
A int without system versioning
);

--error ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
--error ER_VERS_WRONG_PARAMS
create or replace table t1 (
A int without system versioning
) with system versioning;
Expand Down
Loading

0 comments on commit 303d72a

Please sign in to comment.