Skip to content

Commit 4c1e5c9

Browse files
angelamayxiejycor
andauthored
Update sql/analyzer/triggers.go with James's suggestion
Co-authored-by: James Cor <[email protected]>
1 parent 8bfebda commit 4c1e5c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sql/analyzer/triggers.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,13 @@ func getTriggerLogic(ctx *sql.Context, a *Analyzer, n sql.Node, scope *plan.Scop
514514

515515
// validateNoConflictingColumnNames checks the columns of a joined table to make sure there are no conflicting column
516516
// names
517-
func validateNoConflictingColumnNames(n sql.Node) error {
518-
sch := n.Schema()
519-
columnNames := make(map[string]string)
517+
func validateNoConflictingColumnNames(sch sql.Schema) error {
518+
columnNames := make(map[string]struct{})
520519
for _, col := range sch {
521-
if sourceName, ok := columnNames[col.Name]; ok && sourceName != col.Source {
520+
if _, ok := columnNames[col.Name]; ok {
522521
return errors.New("Unable to apply triggers when joined tables have columns with the same name")
523522
}
524-
columnNames[col.Name] = col.Source
523+
columnNames[col.Name] = struct{}{}
525524
}
526525
return nil
527526
}

0 commit comments

Comments
 (0)