summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2019-02-05 11:24:19 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2019-02-05 11:24:19 +0400
commitf53e795250133a622eb1c00271c073726ae3c7fc (patch)
tree3e607f3f22bb920fb67b67a1b2083801c53bedef /sql/sql_yacc.yy
parent227379988eac3c9ce7be626477f4d138dc34579d (diff)
downloadmariadb-git-f53e795250133a622eb1c00271c073726ae3c7fc.tar.gz
MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
The list of table constraints doesn't include foreign keys and uniques. So we replace DROP CONSTRAINT with DROP [FOREIGN] KEY in this case.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 480c2e9bacb..14d084e7022 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1741,7 +1741,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name
sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
- opt_constraint constraint opt_ident ident_table_alias
+ opt_constraint opt_constraint_no_id constraint opt_ident ident_table_alias
%type <lex_str_ptr>
opt_table_alias
@@ -6123,6 +6123,11 @@ check_constraint:
}
;
+opt_constraint_no_id:
+ /* Empty */ {}
+ | CONSTRAINT {}
+ ;
+
opt_constraint:
/* empty */ { $$= null_lex_str; }
| constraint { $$= $1; }
@@ -7653,7 +7658,7 @@ alter_list_item:
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= Alter_info::DROP_FOREIGN_KEY;
}
- | DROP PRIMARY_SYM KEY_SYM
+ | DROP opt_constraint_no_id PRIMARY_SYM KEY_SYM
{
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)