Skip to content

Commit

Permalink
test: add failing one-case test to show the panic
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>
  • Loading branch information
GuptaManan100 committed Jan 24, 2024
1 parent edf6832 commit c4bd538
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion go/vt/vtgate/planbuilder/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ func setFks(t *testing.T, vschema *vindexes.VSchema) {
// FK from tblrefDef referencing tbl20 that is shard scoped of SET-Default types.
_ = vschema.AddForeignKey("sharded_fk_allow", "tblrefDef", createFkDefinition([]string{"ref"}, "tbl20", []string{"col2"}, sqlparser.SetDefault, sqlparser.SetDefault))

// FK from tbl_auth referencing tbl20 that is shard scoped of CASCADE types.
_ = vschema.AddForeignKey("sharded_fk_allow", "tbl_auth", createFkDefinition([]string{"id"}, "tbl20", []string{"col2"}, sqlparser.Cascade, sqlparser.Cascade))
addPKs(t, vschema, "sharded_fk_allow", []string{"tbl1", "tbl2", "tbl3", "tbl4", "tbl5", "tbl6", "tbl7", "tbl9", "tbl10",
"multicol_tbl1", "multicol_tbl2", "tblrefDef", "tbl20"})
"multicol_tbl1", "multicol_tbl2", "tbl_auth", "tblrefDef", "tbl20"})
}
if vschema.Keyspaces["unsharded_fk_allow"] != nil {
// u_tbl2(col2) -> u_tbl1(col1) Cascade.
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/testdata/onecase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"comment": "Add your test case here for debugging and run go test -run=One.",
"query": "",
"query": "update tbl_auth set unknown_col = 'verified' where id = 1",
"plan": {

}
Expand Down
14 changes: 14 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/vschemas/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,20 @@
}
]
},
"tbl_auth": {
"columns": [
{
"name": "id"
}
],
"column_vindexes": [
{
"column": "id",
"name": "hash_vin"
}
],
"column_list_authoritative": true
},
"tblrefDef": {
"column_vindexes": [
{
Expand Down

0 comments on commit c4bd538

Please sign in to comment.