Skip to content

Commit c42d39f

Browse files
author
James Cor
committed
Merge branch 'main' into james/proc
2 parents fae1af9 + a4f4b07 commit c42d39f

File tree

6 files changed

+24071
-22621
lines changed

6 files changed

+24071
-22621
lines changed

enginetest/queries/foreign_key_queries.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,22 @@ var ForeignKeyTests = []ScriptTest{
380380
},
381381
},
382382
},
383+
{
384+
Name: "DROP TABLE, with multiple tables, sorts by foreign key dependencies",
385+
SetUpScript: []string{
386+
"create table grandparent1 (pk int primary key);",
387+
"create table parent1 (pk int primary key, c1 int references grandparent(pk));",
388+
"create table parent2 (pk int primary key);",
389+
"create table child1 (pk int primary key, c1 int, c2 int, foreign key (c1) references parent1(pk), foreign key (c2) references parent2(pk));",
390+
"create table selfref (pk int primary key, c1 int, foreign key (c1) references selfref(pk));",
391+
},
392+
Assertions: []ScriptTestAssertion{
393+
{
394+
Query: "DROP TABLE grandparent1, parent1, parent2, selfref, child1;",
395+
Expected: []sql.Row{{types.NewOkResult(0)}},
396+
},
397+
},
398+
},
383399
{
384400
Name: "Indexes used by foreign keys can't be dropped",
385401
SetUpScript: []string{

0 commit comments

Comments
 (0)