diff options
Diffstat (limited to 'mysql-test/suite/vcol/t/vcol_syntax.test')
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_syntax.test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/t/vcol_syntax.test b/mysql-test/suite/vcol/t/vcol_syntax.test index 6dc3cf43317..f425b52ab79 100644 --- a/mysql-test/suite/vcol/t/vcol_syntax.test +++ b/mysql-test/suite/vcol/t/vcol_syntax.test @@ -28,3 +28,47 @@ show create table t1; drop table t1; set session sql_mode=@OLD_SQL_MODE; +--echo # +--echo # MDEV-25091 CREATE TABLE: field references qualified by a wrong table name succeed +--echo # +create table t2 (x int); + +--error ER_BAD_FIELD_ERROR +create table t1 (x int, y int generated always as (t2.x)); +--error ER_BAD_FIELD_ERROR +create table t1 (x int, y int check (y > t2.x)); +--error ER_BAD_FIELD_ERROR +create table t1 (x int, y int default t2.x); +--error ER_BAD_FIELD_ERROR +create table t1 (x int, check (t2.x > 0)); + +create table t1 (x int); +--error ER_BAD_FIELD_ERROR +alter table t1 add column y int generated always as (t2.x); +--error ER_BAD_FIELD_ERROR +alter table t1 add column y int check (z > t2.x); +--error ER_BAD_FIELD_ERROR +alter table t1 add column y int default t2.x; +--error ER_BAD_FIELD_ERROR +alter table t1 add constraint check (t2.x > 0); + +create or replace table t1 (x int, y int generated always as (t1.x)); +create or replace table t1 (x int, y int check (y > t1.x)); +create or replace table t1 (x int, y int default t1.x); +create or replace table t1 (x int, check (t1.x > 0)); + +create or replace table t1 (x int, y int generated always as (test.t1.x)); +create or replace table t1 (x int, y int check (y > test.t1.x)); +create or replace table t1 (x int, y int default test.t1.x); +create or replace table t1 (x int, check (test.t1.x > 0)); + +drop tables t1, t2; + +--error ER_BAD_FIELD_ERROR +create table t1 (x int, y int generated always as (test2.t1.x)); +--error ER_BAD_FIELD_ERROR +create table t1 (x int, y int check (y > test2.t1.x)); +--error ER_BAD_FIELD_ERROR +create table t1 (x int, y int default test2.t1.x); +--error ER_BAD_FIELD_ERROR +create table t1 (x int, check (test2.t1.x > 0)); |