diff --git a/go/vt/vtexplain/vtexplain_vttablet.go b/go/vt/vtexplain/vtexplain_vttablet.go index 193da213c16..2a1e0b18587 100644 --- a/go/vt/vtexplain/vtexplain_vttablet.go +++ b/go/vt/vtexplain/vtexplain_vttablet.go @@ -371,7 +371,12 @@ func initTabletEnvironment(ddls []sqlparser.DDLStatement, opts *Options) error { showTableRows := make([][]sqltypes.Value, 0, 4) for _, ddl := range ddls { table := ddl.GetTable().Name.String() - showTableRows = append(showTableRows, mysql.BaseShowTablesRow(table, false, "")) + options := "" + spec := ddl.GetTableSpec() + if spec != nil && strings.Contains(spec.Options, "vitess_sequence") { + options = "vitess_sequence" + } + showTableRows = append(showTableRows, mysql.BaseShowTablesRow(table, false, options)) } schemaQueries[mysql.BaseShowTables] = &sqltypes.Result{ Fields: mysql.BaseShowTablesFields, diff --git a/go/vt/vtexplain/vtexplain_vttablet_test.go b/go/vt/vtexplain/vtexplain_vttablet_test.go index 7854b794d42..9710e116231 100644 --- a/go/vt/vtexplain/vtexplain_vttablet_test.go +++ b/go/vt/vtexplain/vtexplain_vttablet_test.go @@ -20,6 +20,8 @@ import ( "encoding/json" "testing" + "vitess.io/vitess/go/vt/vttablet/tabletserver/schema" + topodatapb "vitess.io/vitess/go/vt/proto/topodata" ) @@ -43,6 +45,13 @@ create table t4 like t3; create table t5 (like t2); +create table t1_seq( + id int, + next_id bigint, + cache bigint, + primary key(id) +) comment 'vitess_sequence'; + create table test_partitioned ( id bigint, date_create int, @@ -114,6 +123,11 @@ create table test_partitioned ( if t5.HasPrimary() || len(t5.PKColumns) != 0 { t.Errorf("expected !HasPrimary && t5.PKColumns == [] got %v", t5.PKColumns) } + + seq := tables["t1_seq"] + if seq.Type != schema.Sequence { + t.Errorf("expected t1_seq to be a sequence table but is type %v", seq.Type) + } } func TestErrParseSchema(t *testing.T) {