Skip to content

Commit 84f86a6

Browse files
sryoyaolavloite
andauthored
feat(spannertest): Add validation of duplicated column names (#4611)
* feat(spannertest): add validation for duplicated column names * feat(spannertest): fix error message in validation of duplicated column Co-authored-by: Knut Olav Løite <koloite@gmail.com> Co-authored-by: Knut Olav Løite <koloite@gmail.com>
1 parent 7d85249 commit 84f86a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spanner/spannertest/db.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ func (t *table) addColumn(cd spansql.ColumnDef, newTable bool) *status.Status {
622622
return status.Newf(codes.InvalidArgument, "new non-key columns cannot be NOT NULL")
623623
}
624624

625+
if _, ok := t.colIndex[cd.Name]; ok {
626+
return status.Newf(codes.AlreadyExists, "column %s already exists", cd.Name)
627+
}
628+
625629
t.mu.Lock()
626630
defer t.mu.Unlock()
627631

0 commit comments

Comments
 (0)