Skip to content

Commit ec2567a

Browse files
committed
fix validateNoConflictingColumnNames input and add test case for table joining on itself without an alias
1 parent 4c1e5c9 commit ec2567a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

enginetest/queries/update_queries.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,11 @@ var UpdateErrorTests = []QueryErrorTest{
943943
Query: `UPDATE people SET height_inches = IF(ROW_NUMBER() OVER() % 2 = 0, 42, height_inches)`,
944944
ExpectedErr: sql.ErrWindowUnsupported,
945945
},
946+
{
947+
Query: `update people join people set height_inches = 100 where height_inches < 100`,
948+
// TODO: mysql outputs sql.ErrDuplicateAliasOrTable error instead
949+
ExpectedErr: sql.ErrAmbiguousColumnName,
950+
},
946951
}
947952

948953
var UpdateErrorScripts = []ScriptTest{

sql/analyzer/triggers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ func getTriggerLogic(ctx *sql.Context, a *Analyzer, n sql.Node, scope *plan.Scop
483483
} else {
484484
// TODO: We should be able to handle duplicate column names by masking columns that aren't part of the
485485
// triggered table https://github.com/dolthub/dolt/issues/9403
486-
err = validateNoConflictingColumnNames(updateSrc.Child)
486+
err = validateNoConflictingColumnNames(updateSrc.Child.Schema())
487487
if err != nil {
488488
return nil, err
489489
}

0 commit comments

Comments
 (0)