diff --git a/go/vt/topotools/vschema_ddl.go b/go/vt/topotools/vschema_ddl.go index 30cce3bd5db..e8da2734b4f 100644 --- a/go/vt/topotools/vschema_ddl.go +++ b/go/vt/topotools/vschema_ddl.go @@ -17,7 +17,6 @@ limitations under the License. package topotools import ( - "fmt" "reflect" "vitess.io/vitess/go/vt/sqlparser" @@ -226,15 +225,9 @@ func ApplyVSchemaDDL(ksName string, ks *vschemapb.Keyspace, alterVschema *sqlpar return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "vschema already contains auto inc %v on table %s in keyspace %s", table.AutoIncrement, name, ksName) } - sequence := alterVschema.AutoIncSpec.Sequence - sequenceFqn := sequence.Name.String() - if sequence.Qualifier.String() != "" { - sequenceFqn = fmt.Sprintf("%s.%s", sequence.Qualifier.String(), sequenceFqn) - } - table.AutoIncrement = &vschemapb.AutoIncrement{ Column: alterVschema.AutoIncSpec.Column.String(), - Sequence: sequenceFqn, + Sequence: sqlparser.String(alterVschema.AutoIncSpec.Sequence), } return ks, nil diff --git a/go/vt/vtgate/executor_vschema_ddl_test.go b/go/vt/vtgate/executor_vschema_ddl_test.go index d5da6858c5a..7e71012f128 100644 --- a/go/vt/vtgate/executor_vschema_ddl_test.go +++ b/go/vt/vtgate/executor_vschema_ddl_test.go @@ -373,13 +373,13 @@ func TestExecutorAddSequenceDDL(t *testing.T) { } time.Sleep(10 * time.Millisecond) - stmt = "alter vschema on test_table add auto_increment id using test_seq" + stmt = "alter vschema on test_table add auto_increment id using `db-name`.`test_seq`" if _, err = executor.Execute(context.Background(), "TestExecute", session, stmt, nil); err != nil { t.Error(err) } time.Sleep(10 * time.Millisecond) - wantAutoInc := &vschemapb.AutoIncrement{Column: "id", Sequence: "test_seq"} + wantAutoInc := &vschemapb.AutoIncrement{Column: "id", Sequence: "`db-name`.test_seq"} gotAutoInc := executor.vm.GetCurrentSrvVschema().Keyspaces[ksSharded].Tables["test_table"].AutoIncrement if !reflect.DeepEqual(wantAutoInc, gotAutoInc) {