Skip to content
Merged
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
7 changes: 6 additions & 1 deletion sql/planbuilder/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,18 @@ func (b *Builder) buildShowAllColumns(inScope *scope, s *ast.Show) (outScope *sc
}

var dbName string
var schemaName string
if s.ShowTablesOpt != nil && s.ShowTablesOpt.DbName != "" {
dbName = s.ShowTablesOpt.DbName
} else if s.Table.DbQualifier.String() != "" {
dbName = s.Table.DbQualifier.String()
}

tableScope, ok := b.buildResolvedTable(inScope, dbName, "", s.Table.Name.String(), asOf)
if s.ShowTablesOpt != nil && s.ShowTablesOpt.SchemaName != "" {
schemaName = s.ShowTablesOpt.SchemaName
}

tableScope, ok := b.buildResolvedTable(inScope, dbName, schemaName, s.Table.Name.String(), asOf)
if !ok {
err := sql.ErrTableNotFound.New(s.Table.Name.String())
b.handleErr(err)
Expand Down