Skip to content

Commit

Permalink
Added schema to SHOW COLUMNS
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmu committed Oct 9, 2024
1 parent fac5030 commit a881864
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions 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

0 comments on commit a881864

Please sign in to comment.