requireTargets fails when a recognized DML statement yields no backup target. Returning an empty list with no error would let the task executor treat the backup as a successful no-op and run the mutation unprotected (e.g. when a table alias collides with a CTE name, so the only target gets filtered
(infos []statementInfo, err error, kind string)
| 176 | // backup as a successful no-op and run the mutation unprotected (e.g. when a |
| 177 | // table alias collides with a CTE name, so the only target gets filtered out). |
| 178 | func requireTargets(infos []statementInfo, err error, kind string) ([]statementInfo, error) { |
| 179 | if err != nil { |
| 180 | return nil, err |
| 181 | } |
| 182 | if len(infos) == 0 { |
| 183 | return nil, errors.Errorf("prior backup could not determine a backup target for the %s statement", kind) |
| 184 | } |
| 185 | return infos, nil |
| 186 | } |
| 187 | |
| 188 | func extractTablesFromDelete(databaseName string, n *ast.DeleteStmt, fullSQL string, isCaseSensitive bool) ([]statementInfo, error) { |
| 189 | cteNames := collectCTENames(fullSQL, n.Loc) |