Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,10 @@ func (e *Executor) handleShow(ctx context.Context, safeSession *SafeSession, sql
destKeyspace = show.OnTable.Qualifier.String()
show.OnTable.Qualifier = sqlparser.NewTableIdent("")
} else if show.ShowTablesOpt != nil {
destKeyspace = show.ShowTablesOpt.DbName
show.ShowTablesOpt.DbName = ""
if show.ShowTablesOpt.DbName != "" {
destKeyspace = show.ShowTablesOpt.DbName
show.ShowTablesOpt.DbName = ""
}
} else {
break
}
Expand Down
8 changes: 5 additions & 3 deletions go/vt/vtgate/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ func TestExecutorShow(t *testing.T) {
session.TargetString = KsTestUnsharded
_, err = executor.Execute(context.Background(), "TestExecute", session, "show create table unknown", nil)
require.NoError(t, err)

_, err = executor.Execute(context.Background(), "TestExecute", session, "show full columns from table1", nil)
require.NoError(t, err)

// Reset target string so other tests dont fail.
session.TargetString = "@master"
_, err = executor.Execute(context.Background(), "TestExecute", session, fmt.Sprintf("show full columns from unknown from %v", KsTestUnsharded), nil)
Expand Down Expand Up @@ -772,9 +776,7 @@ func TestExecutorShow(t *testing.T) {

// Test SHOW FULL COLUMNS FROM where query has a qualifier
_, err = executor.Execute(context.Background(), "TestExecute", session, fmt.Sprintf("show full columns from %v.table1", KsTestUnsharded), nil)
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
require.NoError(t, err)

// Just test for first & last.
qr.Rows = [][]sqltypes.Value{qr.Rows[0], qr.Rows[len(qr.Rows)-1]}
Expand Down