diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2019-11-20 13:18:54 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2019-11-20 13:18:54 +0300 |
commit | daabc5cc68440fe7871b7c570e114a6a0d119bfb (patch) | |
tree | 00b3e0b5802d54326e2c9987c40d40ef1a459b1e /sql/sql_lex.h | |
parent | 5130f5206c150ba1e8a723aae63884ff64408012 (diff) | |
download | mariadb-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 'sql/sql_lex.h')
-rw-r--r-- | sql/sql_lex.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4abc7dde940..0c3108e8ebe 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -4613,6 +4613,15 @@ public: const LEX_CSTRING &name); void mark_first_table_as_inserting(); + + bool add_table_foreign_key(const LEX_CSTRING *name, + const LEX_CSTRING *constraint_name, + Table_ident *table_name, + DDL_options ddl_options); + bool add_column_foreign_key(const LEX_CSTRING *name, + const LEX_CSTRING *constraint_name, + Table_ident *ref_table_name, + DDL_options ddl_options); }; |