Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Cascading a Set Null constraint on a multicol foreign key fails #13987

Closed
GuptaManan100 opened this issue Sep 15, 2023 · 0 comments · Fixed by #13988
Closed

Bug Report: Cascading a Set Null constraint on a multicol foreign key fails #13987

GuptaManan100 opened this issue Sep 15, 2023 · 0 comments · Fixed by #13988

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

This bug was found by the fuzzer that is added in #13980.

=== RUN   TestFkFuzzTest/Unsharded_-_Single_Thread_-_Balanced_Inserts_and_Updates
    mysql.go:228: Vitess and MySQL are not erroring the same way.
        Vitess error: target: uks.0.primary: vttablet: rpc error: code = FailedPrecondition desc = Operand should contain 2 column(s) (errno 1241) (sqlstate 21000) (CallerID: userData1): Sql: "select cola, colb, cola, colb from fk_multicol_t17 where (cola, colb) in ::fkc_vals and (cola, colb) not in (:cola /* INT64 */, :colb /* INT64 */) for update", BindVars: {#maxLimit: "type:INT64 value:\"10001\""cola: "type:INT64 value:\"5\""colb: "type:INT64 value:\"2\""fkc_vals: "type:TUPLE values:{type:TUPLE values:{} values:{}}"id: "type:INT64 value:\"3\""} (errno 1241) (sqlstate 21000) during query: update fk_multicol_t16 set cola = 5, colb = 2 where id = 3
        MySQL error: <nil>
E0914 17:57:47.272051   65012 fk_fuzz_test.go:380] Failing query - update fk_multicol_t16 set cola = 5, colb = 2 where id = 3

We see that the SELECT query that the planner creates is failing.
The schema of the tables are as follows

/*        fk_multicol_t16
 *                    │
 * On Delete Set Null │
 * On Update Set Null │
 *                    │
 *                    ▼
 *        fk_multicol_t17──────────────────┐
 *                    │                    │
 *                    │                    │ On Delete Set Null
 *  On Delete Cascade │                    │ On Update Set Null
 *  On Update Cascade │                    │
 *                    │                    │
 *                    ▼                    ▼
 *        fk_multicol_t18      fk_multicol_t19
 */

Reproduction Steps

Create the tables with the given schema
Then, try running an update query as listed above

Binary Version

main

Operating System and Environment details

main

Log Fragments

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant