diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index b3133c8dd75e4..16e8e73202460 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -1914,3 +1914,20 @@ func (s *testIntegrationSuite3) TestParserIssue284(c *C) { tk.MustExec("drop table test.t_parser_issue_284") tk.MustExec("drop table test.t_parser_issue_284_2") } + +func (s *testIntegrationSuite3) TestForeignKeyOnUpdateOnDelete(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("create database if not exists test_foreign_key_on_update") + tk.MustExec("use test_foreign_key_on_update") + tk.MustExec("create table t (a int)") + tk.MustExec("create table t1 (a int, b int)") + tk.MustExec("create table t2 (a int, b int)") + tk.MustExec("create table t3 (a int, b int)") + tk.MustExec("create table t4 (a int, b int)") + tk.MustExec("alter table t1 add constraint fk_a foreign key (b) references t (a) on update restrict") + tk.MustExec("alter table t2 add constraint fk_a foreign key (a) references t (a) on update set null") + tk.MustExec("alter table t3 add constraint fk_a foreign key (a) references t (a) on update cascade on delete set null") + tk.MustExec("alter table t4 add constraint fk_a foreign key (a) references t (a) on update restrict on delete set null") + tk.MustExec("create table t5 (a int, b int, foreign key (b) references t (a) on update restrict)") + tk.MustExec("create table t6 (a int, b int, foreign key (b) references t (a) on update restrict on delete restrict)") +} diff --git a/go.mod b/go.mod index acf2063264728..14a28dfa99a0e 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e github.com/pingcap/kvproto v0.0.0-20191106014506-c5d88d699a8d github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd - github.com/pingcap/parser v0.0.0-20191118062434-7c5018645942 + github.com/pingcap/parser v0.0.0-20191120072812-9dc33a611210 github.com/pingcap/pd v1.1.0-beta.0.20190912093418-dc03c839debd github.com/pingcap/tidb-tools v3.0.6-0.20191119150227-ff0a3c6e5763+incompatible github.com/pingcap/tipb v0.0.0-20191120045257-1b9900292ab6 diff --git a/go.sum b/go.sum index 3c939d2889f00..88b1617d02a93 100644 --- a/go.sum +++ b/go.sum @@ -153,8 +153,8 @@ github.com/pingcap/kvproto v0.0.0-20191106014506-c5d88d699a8d h1:zTHgLr8+0LTEJmj github.com/pingcap/kvproto v0.0.0-20191106014506-c5d88d699a8d/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY= github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd h1:hWDol43WY5PGhsh3+8794bFHY1bPrmu6bTalpssCrGg= github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw= -github.com/pingcap/parser v0.0.0-20191118062434-7c5018645942 h1:JAPbnAxPryeAO50UO89/9MDYJK38Ts7mykTDqgUS14k= -github.com/pingcap/parser v0.0.0-20191118062434-7c5018645942/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= +github.com/pingcap/parser v0.0.0-20191120072812-9dc33a611210 h1:RtNufGeP4yfSgjN0e9TSiNwq1eI4f5YKwNVNqX2OIXM= +github.com/pingcap/parser v0.0.0-20191120072812-9dc33a611210/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= github.com/pingcap/pd v1.1.0-beta.0.20190912093418-dc03c839debd h1:bKj6hodu/ro78B0oN2yicdGn0t4yd9XjnyoW95qmWic= github.com/pingcap/pd v1.1.0-beta.0.20190912093418-dc03c839debd/go.mod h1:I7TEby5BHTYIxgHszfsOJSBsk8b2Qt8QrSIgdv5n5QQ= github.com/pingcap/tidb-tools v3.0.6-0.20191119150227-ff0a3c6e5763+incompatible h1:I8HirWsu1MZp6t9G/g8yKCEjJJxtHooKakEgccvdJ4M=