extractUpdateColumns extracts column names from SET assignments that belong to the original table.
(setList []*ast.Assignment, database, _ string, matchedTable *TableReference, normalColumns []string)
| 193 | // extractUpdateColumns extracts column names from SET assignments that belong |
| 194 | // to the original table. |
| 195 | func extractUpdateColumns(setList []*ast.Assignment, database, _ string, matchedTable *TableReference, normalColumns []string) []string { |
| 196 | var result []string |
| 197 | for _, assignment := range setList { |
| 198 | col := assignment.Column |
| 199 | if col == nil { |
| 200 | continue |
| 201 | } |
| 202 | |
| 203 | if col.Schema != "" && !strings.EqualFold(col.Schema, database) { |
| 204 | continue |
| 205 | } |
| 206 | |
| 207 | if col.Table == "" { |
| 208 | // Unqualified column: check if it belongs to the normalColumns set. |
| 209 | for _, c := range normalColumns { |
| 210 | if strings.EqualFold(c, col.Column) { |
| 211 | result = append(result, col.Column) |
| 212 | break |
| 213 | } |
| 214 | } |
| 215 | continue |
| 216 | } |
| 217 | |
| 218 | if matchedTable != nil && (col.Table == matchedTable.Alias || strings.EqualFold(col.Table, matchedTable.Table)) { |
| 219 | result = append(result, col.Column) |
| 220 | } |
| 221 | } |
| 222 | return result |
| 223 | } |
| 224 | |
| 225 | func hasDisjointUniqueKey(ctx context.Context, rCtx base.RestoreContext, originalDatabase, originalTable string, updateColumns []string) (bool, error) { |
| 226 | columnMap := make(map[string]bool) |
no outgoing calls
no test coverage detected