summaryrefslogtreecommitdiff
path: root/mysql-test/suite/vcol
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-11-20 13:18:54 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-11-20 13:18:54 +0300
commitdaabc5cc68440fe7871b7c570e114a6a0d119bfb (patch)
tree00b3e0b5802d54326e2c9987c40d40ef1a459b1e /mysql-test/suite/vcol
parent5130f5206c150ba1e8a723aae63884ff64408012 (diff)
downloadmariadb-git-daabc5cc68440fe7871b7c570e114a6a0d119bfb.tar.gz
MDEV-20729 Fix REFERENCES constraint in column definition
Add support of referential constraints directly in column defininions: create table t1 (id1 int primary key); create table t2 (id2 int references t1(id1)); Referenced field name can be omitted if equal to foreign field name: create table t1 (id int primary key); create table t2 (id int references t1); Until 10.5 this syntax was understood by the parser but was silently ignored. In case of generated columns this syntax is disabled at parser level by ER_PARSE_ERROR. Note that separate FOREIGN KEY clause for generated columns is disabled at storage engine level.
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r--mysql-test/suite/vcol/inc/vcol_column_def_options.inc6
-rw-r--r--mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result6
-rw-r--r--mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result6
3 files changed, 9 insertions, 9 deletions
diff --git a/mysql-test/suite/vcol/inc/vcol_column_def_options.inc b/mysql-test/suite/vcol/inc/vcol_column_def_options.inc
index 2f28136ad63..61eac0014bc 100644
--- a/mysql-test/suite/vcol/inc/vcol_column_def_options.inc
+++ b/mysql-test/suite/vcol/inc/vcol_column_def_options.inc
@@ -103,11 +103,11 @@ drop table t1;
create table t2 (a int);
-create table t1 (a int, b int as (a % 2) persistent references t2(a));
+create table t1 (a int, b int as (a % 2) persistent);
show create table t1;
drop table t1;
create table t1 (a int, b int as (a % 2));
---error ER_PARSE_ERROR
-alter table t1 modify b int as (a % 2) persistent references t2(a);
+--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
+alter table t1 modify b int as (a % 2) persistent;
show create table t1;
drop table t1;
diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result
index 0f80365f6a7..f6c58e63e59 100644
--- a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result
@@ -126,7 +126,7 @@ a b
2 0
drop table t1;
create table t2 (a int);
-create table t1 (a int, b int as (a % 2) persistent references t2(a));
+create table t1 (a int, b int as (a % 2) persistent);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -135,8 +135,8 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int, b int as (a % 2));
-alter table t1 modify b int as (a % 2) persistent references t2(a);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'references t2(a)' at line 1
+alter table t1 modify b int as (a % 2) persistent;
+ERROR HY000: This is not yet supported for generated columns
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result
index e53a7594663..204ce1d880c 100644
--- a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result
@@ -126,7 +126,7 @@ a b
2 0
drop table t1;
create table t2 (a int);
-create table t1 (a int, b int as (a % 2) persistent references t2(a));
+create table t1 (a int, b int as (a % 2) persistent);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -135,8 +135,8 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int, b int as (a % 2));
-alter table t1 modify b int as (a % 2) persistent references t2(a);
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'references t2(a)' at line 1
+alter table t1 modify b int as (a % 2) persistent;
+ERROR HY000: This is not yet supported for generated columns
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (