Skip to content

Commit

Permalink
fix create table retry (#13912)
Browse files Browse the repository at this point in the history
use old table to create table and auto increment when retry.

Approved by: @nnsgmsone
  • Loading branch information
zhangxu19830126 authored Dec 29, 2023
1 parent 71fe33a commit 064c1cf
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pkg/sql/compile/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2632,17 +2632,16 @@ func maybeCreateAutoIncrement(
def *plan.TableDef,
txnOp client.TxnOperator,
nameResolver func() string) error {
if def.TblId == 0 {
name := def.Name
if nameResolver != nil {
name = nameResolver()
}
tb, err := db.Relation(ctx, name, nil)
if err != nil {
return err
}
def.TblId = tb.GetTableID(ctx)
name := def.Name
if nameResolver != nil {
name = nameResolver()
}
tb, err := db.Relation(ctx, name, nil)
if err != nil {
return err
}
def.TblId = tb.GetTableID(ctx)

cols := incrservice.GetAutoColumnFromDef(def)
if len(cols) == 0 {
return nil
Expand Down

0 comments on commit 064c1cf

Please sign in to comment.