We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2de759 commit 14a7c3cCopy full SHA for 14a7c3c
sql/planbuilder/ddl.go
@@ -452,11 +452,20 @@ func (b *Builder) buildCreateTableLike(inScope *scope, ct *ast.DDL) *scope {
452
}
453
454
455
+ var hasSkippedCols bool
456
for _, col := range pkSch.Schema {
457
+ name := strings.ToLower(col.Name)
458
+ if _, ok := newSchMap[name]; ok {
459
+ // TODO: throw warning
460
+ hasSkippedCols = true
461
+ continue
462
+ }
463
newSch = append(newSch, col)
464
- for _, pkOrd := range pkSch.PkOrdinals {
- pkOrdinals = append(pkOrdinals, len(newSch)+pkOrd)
465
+ if !hasSkippedCols {
466
+ for _, pkOrd := range pkSch.PkOrdinals {
467
+ pkOrdinals = append(pkOrdinals, len(newSch)+pkOrd)
468
469
470
471
pkSchema := sql.NewPrimaryKeySchema(newSch, pkOrdinals...)
0 commit comments