From c0b303d97edb7289e7c72ab7b021d038e7460edb Mon Sep 17 00:00:00 2001 From: Manan Gupta <35839558+GuptaManan100@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:34:09 +0530 Subject: [PATCH] Fix Delete with multi-tables related by foreign keys (#15218) Signed-off-by: Manan Gupta --- go/test/endtoend/vtgate/foreignkey/fk_test.go | 10 + go/vt/sqlparser/ast_format.go | 2 +- go/vt/sqlparser/ast_format_fast.go | 2 +- go/vt/sqlparser/ast_funcs.go | 2 +- go/vt/vtgate/planbuilder/operators/delete.go | 32 +- .../testdata/foreignkey_cases.json | 345 ++++++++++++------ .../testdata/foreignkey_checks_on_cases.json | 8 +- 7 files changed, 284 insertions(+), 117 deletions(-) diff --git a/go/test/endtoend/vtgate/foreignkey/fk_test.go b/go/test/endtoend/vtgate/foreignkey/fk_test.go index ff4126387b8..b16da5bfabd 100644 --- a/go/test/endtoend/vtgate/foreignkey/fk_test.go +++ b/go/test/endtoend/vtgate/foreignkey/fk_test.go @@ -967,6 +967,16 @@ func TestFkQueries(t *testing.T) { "update fk_t16 set col = col * (col - (col)) where id = 4", }, }, + { + name: "Multi table delete that uses two tables related by foreign keys", + queries: []string{ + "insert /*+ SET_VAR(foreign_key_checks=0) */ into fk_t10 (id, col) values (1, '5'), (2, NULL), (3, NULL), (4, '4'), (6, '1'), (7, '2')", + "insert /*+ SET_VAR(foreign_key_checks=0) */ into fk_t11 (id, col) values (4, '1'), (5, '3'), (7, '22'), (8, '5'), (9, NULL), (10, '3')", + "insert /*+ SET_VAR(foreign_key_checks=0) */ into fk_t12 (id, col) values (2, NULL), (3, NULL), (4, '1'), (6, '6'), (8, NULL), (10, '1')", + "insert /*+ SET_VAR(foreign_key_checks=0) */ into fk_t13 (id, col) values (2, '1'), (5, '5'), (7, '5')", + "delete fk_t11 from fk_t11 join fk_t12 using (id) where fk_t11.id = 4", + }, + }, } for _, testcase := range testcases { diff --git a/go/vt/sqlparser/ast_format.go b/go/vt/sqlparser/ast_format.go index 59ed4add5ee..33ea8666c9d 100644 --- a/go/vt/sqlparser/ast_format.go +++ b/go/vt/sqlparser/ast_format.go @@ -177,7 +177,7 @@ func (node *Delete) Format(buf *TrackedBuffer) { if node.Ignore { buf.literal("ignore ") } - if node.Targets != nil && !node.isSingleAliasExpr() { + if node.Targets != nil && !node.IsSingleAliasExpr() { buf.astPrintf(node, "%v ", node.Targets) } prefix := "from " diff --git a/go/vt/sqlparser/ast_format_fast.go b/go/vt/sqlparser/ast_format_fast.go index bad1854d28e..0f84cb64e7f 100644 --- a/go/vt/sqlparser/ast_format_fast.go +++ b/go/vt/sqlparser/ast_format_fast.go @@ -257,7 +257,7 @@ func (node *Delete) FormatFast(buf *TrackedBuffer) { if node.Ignore { buf.WriteString("ignore ") } - if node.Targets != nil && !node.isSingleAliasExpr() { + if node.Targets != nil && !node.IsSingleAliasExpr() { node.Targets.FormatFast(buf) buf.WriteByte(' ') } diff --git a/go/vt/sqlparser/ast_funcs.go b/go/vt/sqlparser/ast_funcs.go index a8d231d6aa1..5e63774f5bf 100644 --- a/go/vt/sqlparser/ast_funcs.go +++ b/go/vt/sqlparser/ast_funcs.go @@ -2587,7 +2587,7 @@ func (ct *ColumnType) Invisible() bool { return ct.Options.Invisible != nil && *ct.Options.Invisible } -func (node *Delete) isSingleAliasExpr() bool { +func (node *Delete) IsSingleAliasExpr() bool { if len(node.Targets) > 1 { return false } diff --git a/go/vt/vtgate/planbuilder/operators/delete.go b/go/vt/vtgate/planbuilder/operators/delete.go index 4bc2f48f4d8..7a497d5511c 100644 --- a/go/vt/vtgate/planbuilder/operators/delete.go +++ b/go/vt/vtgate/planbuilder/operators/delete.go @@ -82,10 +82,11 @@ func (d *Delete) ShortDescription() string { func createOperatorFromDelete(ctx *plancontext.PlanningContext, deleteStmt *sqlparser.Delete) (op Operator) { childFks := ctx.SemTable.GetChildForeignKeysForTable(deleteStmt.Targets[0]) - // If the delete statement has a limit and has foreign keys, we will use a DMLWithInput - // operator wherein we do a selection first and use that output for the subsequent deletes. - if len(childFks) > 0 && deleteStmt.Limit != nil { - return deletePlanningForLimitFk(ctx, deleteStmt) + // We check if delete with input plan is required. DML with input planning is generally + // slower, because it does a selection and then creates a delete statement wherein we have to + // list all the primary key values. + if deleteWithInputPlanningRequired(childFks, deleteStmt) { + return deleteWithInputPlanningForFk(ctx, deleteStmt) } delClone := sqlparser.CloneRefOfDelete(deleteStmt) @@ -107,7 +108,23 @@ func createOperatorFromDelete(ctx *plancontext.PlanningContext, deleteStmt *sqlp return createFkCascadeOpForDelete(ctx, op, delClone, childFks, delOp.Target.VTable) } -func deletePlanningForLimitFk(ctx *plancontext.PlanningContext, del *sqlparser.Delete) Operator { +func deleteWithInputPlanningRequired(childFks []vindexes.ChildFKInfo, deleteStmt *sqlparser.Delete) bool { + // If there are no foreign keys, we don't need to use delete with input. + if len(childFks) == 0 { + return false + } + // Limit requires delete with input. + if deleteStmt.Limit != nil { + return true + } + // If there are no limit clauses, and it is not a multi-delete, we don't need delete with input. + // TODO: In the future, we can check if the tables involved in the multi-table delete are related by foreign keys or not. + // If they aren't then we don't need the multi-table delete. But this check isn't so straight-forward. We need to check if the two + // tables are connected in the undirected graph built from the tables related by foreign keys. + return !deleteStmt.IsSingleAliasExpr() +} + +func deleteWithInputPlanningForFk(ctx *plancontext.PlanningContext, del *sqlparser.Delete) Operator { delClone := ctx.SemTable.Clone(del).(*sqlparser.Delete) del.Limit = nil del.OrderBy = nil @@ -129,7 +146,7 @@ func deletePlanningForLimitFk(ctx *plancontext.PlanningContext, del *sqlparser.D var leftComp sqlparser.ValTuple cols := make([]*sqlparser.ColName, 0, len(vTbl.PrimaryKey)) for _, col := range vTbl.PrimaryKey { - colName := sqlparser.NewColName(col.String()) + colName := sqlparser.NewColNameWithQualifier(col.String(), vTbl.GetTableName()) selectStmt.SelectExprs = append(selectStmt.SelectExprs, aeWrap(colName)) cols = append(cols, colName) leftComp = append(leftComp, colName) @@ -141,6 +158,9 @@ func deletePlanningForLimitFk(ctx *plancontext.PlanningContext, del *sqlparser.D lhs = leftComp[0] } compExpr := sqlparser.NewComparisonExpr(sqlparser.InOp, lhs, sqlparser.ListArg(engine.DmlVals), nil) + + del.Targets = sqlparser.TableNames{del.Targets[0]} + del.TableExprs = sqlparser.TableExprs{ti.GetAliasedTableExpr()} del.Where = sqlparser.NewWhere(sqlparser.WhereClause, compExpr) return &DMLWithInput{ diff --git a/go/vt/vtgate/planbuilder/testdata/foreignkey_cases.json b/go/vt/vtgate/planbuilder/testdata/foreignkey_cases.json index 1c1bcc9144a..c8f059b7b88 100644 --- a/go/vt/vtgate/planbuilder/testdata/foreignkey_cases.json +++ b/go/vt/vtgate/planbuilder/testdata/foreignkey_cases.json @@ -1265,8 +1265,8 @@ "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select id from u_tbl2 where 1 != 1", - "Query": "select id from u_tbl2 limit 2 for update", + "FieldQuery": "select u_tbl2.id from u_tbl2 where 1 != 1", + "Query": "select u_tbl2.id from u_tbl2 limit 2 for update", "Table": "u_tbl2" }, { @@ -1281,7 +1281,7 @@ "Sharded": false }, "FieldQuery": "select u_tbl2.col2 from u_tbl2 where 1 != 1", - "Query": "select u_tbl2.col2 from u_tbl2 where id in ::dml_vals for update", + "Query": "select u_tbl2.col2 from u_tbl2 where u_tbl2.id in ::dml_vals for update", "Table": "u_tbl2" }, { @@ -1309,7 +1309,7 @@ "Sharded": false }, "TargetTabletType": "PRIMARY", - "Query": "delete from u_tbl2 where id in ::dml_vals", + "Query": "delete from u_tbl2 where u_tbl2.id in ::dml_vals", "Table": "u_tbl2" } ] @@ -3128,47 +3128,67 @@ "QueryType": "DELETE", "Original": "delete u from u_tbl6 u join u_tbl5 m on u.col = m.col where u.col2 = 4 and m.col3 = 6", "Instructions": { - "OperatorType": "FkCascade", + "OperatorType": "DMLWithInput", + "TargetTabletType": "PRIMARY", + "Offset": [ + 0 + ], "Inputs": [ { - "InputName": "Selection", "OperatorType": "Route", "Variant": "Unsharded", "Keyspace": { "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select u_tbl6.col6 from u_tbl6 as u, u_tbl5 as m where 1 != 1", - "Query": "select u_tbl6.col6 from u_tbl6 as u, u_tbl5 as m where u.col = m.col and u.col2 = 4 and m.col3 = 6 for update", + "FieldQuery": "select u_tbl6.id from u_tbl6 as u, u_tbl5 as m where 1 != 1", + "Query": "select u_tbl6.id from u_tbl6 as u, u_tbl5 as m where u.col2 = 4 and m.col3 = 6 and u.col = m.col for update", "Table": "u_tbl5, u_tbl6" }, { - "InputName": "CascadeChild-1", - "OperatorType": "Delete", - "Variant": "Unsharded", - "Keyspace": { - "Name": "unsharded_fk_allow", - "Sharded": false - }, - "TargetTabletType": "PRIMARY", - "BvName": "fkc_vals", - "Cols": [ - 0 - ], - "Query": "delete from u_tbl8 where (col8) in ::fkc_vals", - "Table": "u_tbl8" - }, - { - "InputName": "Parent", - "OperatorType": "Delete", - "Variant": "Unsharded", - "Keyspace": { - "Name": "unsharded_fk_allow", - "Sharded": false - }, - "TargetTabletType": "PRIMARY", - "Query": "delete u from u_tbl6 as u, u_tbl5 as m where u.col2 = 4 and m.col3 = 6 and u.col = m.col", - "Table": "u_tbl6" + "OperatorType": "FkCascade", + "Inputs": [ + { + "InputName": "Selection", + "OperatorType": "Route", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "FieldQuery": "select u_tbl6.col6 from u_tbl6 as u where 1 != 1", + "Query": "select u_tbl6.col6 from u_tbl6 as u where u_tbl6.id in ::dml_vals for update", + "Table": "u_tbl6" + }, + { + "InputName": "CascadeChild-1", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "BvName": "fkc_vals", + "Cols": [ + 0 + ], + "Query": "delete from u_tbl8 where (col8) in ::fkc_vals", + "Table": "u_tbl8" + }, + { + "InputName": "Parent", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "Query": "delete from u_tbl6 as u where u_tbl6.id in ::dml_vals", + "Table": "u_tbl6" + } + ] } ] }, @@ -3186,47 +3206,67 @@ "QueryType": "DELETE", "Original": "delete u_tbl10 from u_tbl10 join u_tbl11 using (id) where id = 5", "Instructions": { - "OperatorType": "FkCascade", + "OperatorType": "DMLWithInput", + "TargetTabletType": "PRIMARY", + "Offset": [ + 0 + ], "Inputs": [ { - "InputName": "Selection", "OperatorType": "Route", "Variant": "Unsharded", "Keyspace": { "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select u_tbl10.col from u_tbl10, u_tbl11 where 1 != 1", - "Query": "select u_tbl10.col from u_tbl10, u_tbl11 where u_tbl10.id = u_tbl11.id and u_tbl10.id = 5 for update", + "FieldQuery": "select u_tbl10.id from u_tbl10, u_tbl11 where 1 != 1", + "Query": "select u_tbl10.id from u_tbl10, u_tbl11 where u_tbl10.id = 5 and u_tbl10.id = u_tbl11.id for update", "Table": "u_tbl10, u_tbl11" }, { - "InputName": "CascadeChild-1", - "OperatorType": "Delete", - "Variant": "Unsharded", - "Keyspace": { - "Name": "unsharded_fk_allow", - "Sharded": false - }, - "TargetTabletType": "PRIMARY", - "BvName": "fkc_vals", - "Cols": [ - 0 - ], - "Query": "delete from u_tbl11 where (col) in ::fkc_vals", - "Table": "u_tbl11" - }, - { - "InputName": "Parent", - "OperatorType": "Delete", - "Variant": "Unsharded", - "Keyspace": { - "Name": "unsharded_fk_allow", - "Sharded": false - }, - "TargetTabletType": "PRIMARY", - "Query": "delete u_tbl10 from u_tbl10, u_tbl11 where u_tbl10.id = 5 and u_tbl10.id = u_tbl11.id", - "Table": "u_tbl10" + "OperatorType": "FkCascade", + "Inputs": [ + { + "InputName": "Selection", + "OperatorType": "Route", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "FieldQuery": "select u_tbl10.col from u_tbl10 where 1 != 1", + "Query": "select u_tbl10.col from u_tbl10 where u_tbl10.id in ::dml_vals for update", + "Table": "u_tbl10" + }, + { + "InputName": "CascadeChild-1", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "BvName": "fkc_vals", + "Cols": [ + 0 + ], + "Query": "delete from u_tbl11 where (col) in ::fkc_vals", + "Table": "u_tbl11" + }, + { + "InputName": "Parent", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "Query": "delete from u_tbl10 where u_tbl10.id in ::dml_vals", + "Table": "u_tbl10" + } + ] } ] }, @@ -3243,27 +3283,25 @@ "QueryType": "DELETE", "Original": "delete u_tbl1 from u_tbl10 join u_tbl1 on u_tbl10.col = u_tbl1.col", "Instructions": { - "OperatorType": "FkCascade", + "OperatorType": "DMLWithInput", + "TargetTabletType": "PRIMARY", + "Offset": [ + 0 + ], "Inputs": [ { - "InputName": "Selection", "OperatorType": "Route", "Variant": "Unsharded", "Keyspace": { "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select u_tbl1.col1 from u_tbl10, u_tbl1 where 1 != 1", - "Query": "select u_tbl1.col1 from u_tbl10, u_tbl1 where u_tbl10.col = u_tbl1.col for update", + "FieldQuery": "select u_tbl1.id from u_tbl10, u_tbl1 where 1 != 1", + "Query": "select u_tbl1.id from u_tbl10, u_tbl1 where u_tbl10.col = u_tbl1.col for update", "Table": "u_tbl1, u_tbl10" }, { - "InputName": "CascadeChild-1", "OperatorType": "FkCascade", - "BvName": "fkc_vals", - "Cols": [ - 0 - ], "Inputs": [ { "InputName": "Selection", @@ -3273,25 +3311,59 @@ "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select u_tbl2.col2 from u_tbl2 where 1 != 1", - "Query": "select u_tbl2.col2 from u_tbl2 where (col2) in ::fkc_vals for update", - "Table": "u_tbl2" + "FieldQuery": "select u_tbl1.col1 from u_tbl1 where 1 != 1", + "Query": "select u_tbl1.col1 from u_tbl1 where u_tbl1.id in ::dml_vals for update", + "Table": "u_tbl1" }, { "InputName": "CascadeChild-1", - "OperatorType": "Update", - "Variant": "Unsharded", - "Keyspace": { - "Name": "unsharded_fk_allow", - "Sharded": false - }, - "TargetTabletType": "PRIMARY", - "BvName": "fkc_vals1", + "OperatorType": "FkCascade", + "BvName": "fkc_vals", "Cols": [ 0 ], - "Query": "update u_tbl3 set col3 = null where (col3) in ::fkc_vals1", - "Table": "u_tbl3" + "Inputs": [ + { + "InputName": "Selection", + "OperatorType": "Route", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "FieldQuery": "select u_tbl2.col2 from u_tbl2 where 1 != 1", + "Query": "select u_tbl2.col2 from u_tbl2 where (col2) in ::fkc_vals for update", + "Table": "u_tbl2" + }, + { + "InputName": "CascadeChild-1", + "OperatorType": "Update", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "BvName": "fkc_vals1", + "Cols": [ + 0 + ], + "Query": "update u_tbl3 set col3 = null where (col3) in ::fkc_vals1", + "Table": "u_tbl3" + }, + { + "InputName": "Parent", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "Query": "delete from u_tbl2 where (col2) in ::fkc_vals", + "Table": "u_tbl2" + } + ] }, { "InputName": "Parent", @@ -3302,22 +3374,10 @@ "Sharded": false }, "TargetTabletType": "PRIMARY", - "Query": "delete from u_tbl2 where (col2) in ::fkc_vals", - "Table": "u_tbl2" + "Query": "delete from u_tbl1 where u_tbl1.id in ::dml_vals", + "Table": "u_tbl1" } ] - }, - { - "InputName": "Parent", - "OperatorType": "Delete", - "Variant": "Unsharded", - "Keyspace": { - "Name": "unsharded_fk_allow", - "Sharded": false - }, - "TargetTabletType": "PRIMARY", - "Query": "delete u_tbl1 from u_tbl10, u_tbl1 where u_tbl10.col = u_tbl1.col", - "Table": "u_tbl1" } ] }, @@ -3349,8 +3409,8 @@ "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select id from u_tbl1 where 1 != 1", - "Query": "select id from u_tbl1 order by id asc limit 1 for update", + "FieldQuery": "select u_tbl1.id from u_tbl1 where 1 != 1", + "Query": "select u_tbl1.id from u_tbl1 order by id asc limit 1 for update", "Table": "u_tbl1" }, { @@ -3365,7 +3425,7 @@ "Sharded": false }, "FieldQuery": "select u_tbl1.col1 from u_tbl1 where 1 != 1", - "Query": "select u_tbl1.col1 from u_tbl1 where id in ::dml_vals for update", + "Query": "select u_tbl1.col1 from u_tbl1 where u_tbl1.id in ::dml_vals for update", "Table": "u_tbl1" }, { @@ -3427,7 +3487,7 @@ "Sharded": false }, "TargetTabletType": "PRIMARY", - "Query": "delete from u_tbl1 where id in ::dml_vals", + "Query": "delete from u_tbl1 where u_tbl1.id in ::dml_vals", "Table": "u_tbl1" } ] @@ -3669,5 +3729,82 @@ "unsharded_fk_allow.u_tbl9" ] } + }, + { + "comment": "Multi table delete such that the two tables are foreign key related", + "query": "delete u_tbl6 from u_tbl6 join u_tbl8 on u_tbl6.id = u_tbl8.id where u_tbl6.id = 4", + "plan": { + "QueryType": "DELETE", + "Original": "delete u_tbl6 from u_tbl6 join u_tbl8 on u_tbl6.id = u_tbl8.id where u_tbl6.id = 4", + "Instructions": { + "OperatorType": "DMLWithInput", + "TargetTabletType": "PRIMARY", + "Offset": [ + 0 + ], + "Inputs": [ + { + "OperatorType": "Route", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "FieldQuery": "select u_tbl6.id from u_tbl6, u_tbl8 where 1 != 1", + "Query": "select u_tbl6.id from u_tbl6, u_tbl8 where u_tbl6.id = 4 and u_tbl6.id = u_tbl8.id for update", + "Table": "u_tbl6, u_tbl8" + }, + { + "OperatorType": "FkCascade", + "Inputs": [ + { + "InputName": "Selection", + "OperatorType": "Route", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "FieldQuery": "select u_tbl6.col6 from u_tbl6 where 1 != 1", + "Query": "select u_tbl6.col6 from u_tbl6 where u_tbl6.id in ::dml_vals for update", + "Table": "u_tbl6" + }, + { + "InputName": "CascadeChild-1", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "BvName": "fkc_vals", + "Cols": [ + 0 + ], + "Query": "delete from u_tbl8 where (col8) in ::fkc_vals", + "Table": "u_tbl8" + }, + { + "InputName": "Parent", + "OperatorType": "Delete", + "Variant": "Unsharded", + "Keyspace": { + "Name": "unsharded_fk_allow", + "Sharded": false + }, + "TargetTabletType": "PRIMARY", + "Query": "delete from u_tbl6 where u_tbl6.id in ::dml_vals", + "Table": "u_tbl6" + } + ] + } + ] + }, + "TablesUsed": [ + "unsharded_fk_allow.u_tbl6", + "unsharded_fk_allow.u_tbl8" + ] + } } ] diff --git a/go/vt/vtgate/planbuilder/testdata/foreignkey_checks_on_cases.json b/go/vt/vtgate/planbuilder/testdata/foreignkey_checks_on_cases.json index 5404be4e1dc..311ff6adbff 100644 --- a/go/vt/vtgate/planbuilder/testdata/foreignkey_checks_on_cases.json +++ b/go/vt/vtgate/planbuilder/testdata/foreignkey_checks_on_cases.json @@ -1265,8 +1265,8 @@ "Name": "unsharded_fk_allow", "Sharded": false }, - "FieldQuery": "select id from u_tbl2 where 1 != 1", - "Query": "select id from u_tbl2 limit 2 for update", + "FieldQuery": "select u_tbl2.id from u_tbl2 where 1 != 1", + "Query": "select u_tbl2.id from u_tbl2 limit 2 for update", "Table": "u_tbl2" }, { @@ -1281,7 +1281,7 @@ "Sharded": false }, "FieldQuery": "select u_tbl2.col2 from u_tbl2 where 1 != 1", - "Query": "select u_tbl2.col2 from u_tbl2 where id in ::dml_vals for update", + "Query": "select u_tbl2.col2 from u_tbl2 where u_tbl2.id in ::dml_vals for update", "Table": "u_tbl2" }, { @@ -1309,7 +1309,7 @@ "Sharded": false }, "TargetTabletType": "PRIMARY", - "Query": "delete /*+ SET_VAR(foreign_key_checks=On) */ from u_tbl2 where id in ::dml_vals", + "Query": "delete /*+ SET_VAR(foreign_key_checks=On) */ from u_tbl2 where u_tbl2.id in ::dml_vals", "Table": "u_tbl2" } ]