You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: go/libraries/doltcore/sqle/enginetest/dolt_queries_workspace.go
+48Lines changed: 48 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1126,4 +1126,52 @@ var DoltWorkspaceScriptTests = []queries.ScriptTest{
1126
1126
},
1127
1127
},
1128
1128
},
1129
+
{
1130
+
// Regression for #11112.
1131
+
Name: "dolt_workspace_* delete restricted by foreign key",
1132
+
SetUpScript: []string{
1133
+
"create table lists (id int primary key, name varchar(100));",
1134
+
"create table list_entries (id int primary key, list_id int not null, content varchar(255), foreign key (list_id) references lists(id));",
1135
+
"call dolt_commit('-Am', 'schema');",
1136
+
"insert into lists values (1, 'list_1');",
1137
+
"insert into list_entries values (1, 1, 'entry_1'), (2, 1, 'entry_2');",
1138
+
},
1139
+
Assertions: []queries.ScriptTestAssertion{
1140
+
{
1141
+
Query: "delete from dolt_workspace_lists where to_id = 1",
1142
+
ExpectedErr: sql.ErrForeignKeyParentViolation,
1143
+
},
1144
+
{
1145
+
Query: "select id from lists order by id",
1146
+
Expected: []sql.Row{{1}},
1147
+
},
1148
+
{
1149
+
Query: "select id, list_id from list_entries order by id",
1150
+
Expected: []sql.Row{{1, 1}, {2, 1}},
1151
+
},
1152
+
},
1153
+
},
1154
+
{
1155
+
Name: "dolt_workspace_* delete cascades through foreign key",
1156
+
SetUpScript: []string{
1157
+
"create table lists (id int primary key, name varchar(100));",
1158
+
"create table list_entries (id int primary key, list_id int not null, content varchar(255), foreign key (list_id) references lists(id) on delete cascade);",
1159
+
"call dolt_commit('-Am', 'schema');",
1160
+
"insert into lists values (1, 'list_1');",
1161
+
"insert into list_entries values (1, 1, 'entry_1'), (2, 1, 'entry_2');",
1162
+
},
1163
+
Assertions: []queries.ScriptTestAssertion{
1164
+
{
1165
+
Query: "delete from dolt_workspace_lists where to_id = 1",
0 commit comments