Skip to content

Commit 7c0788f

Browse files
authored
Merge pull request #2691 from dolthub/zachmu/show-table-schema
Bug fix for DESCRIBE with a schema name
2 parents 487cf93 + 16d1ab3 commit 7c0788f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sql/planbuilder/show.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,18 @@ func (b *Builder) buildShowAllColumns(inScope *scope, s *ast.Show) (outScope *sc
717717
}
718718

719719
var dbName string
720+
var schemaName string
720721
if s.ShowTablesOpt != nil && s.ShowTablesOpt.DbName != "" {
721722
dbName = s.ShowTablesOpt.DbName
722723
} else if s.Table.DbQualifier.String() != "" {
723724
dbName = s.Table.DbQualifier.String()
724725
}
725726

726-
tableScope, ok := b.buildResolvedTable(inScope, dbName, "", s.Table.Name.String(), asOf)
727+
if s.ShowTablesOpt != nil && s.ShowTablesOpt.SchemaName != "" {
728+
schemaName = s.ShowTablesOpt.SchemaName
729+
}
730+
731+
tableScope, ok := b.buildResolvedTable(inScope, dbName, schemaName, s.Table.Name.String(), asOf)
727732
if !ok {
728733
err := sql.ErrTableNotFound.New(s.Table.Name.String())
729734
b.handleErr(err)

0 commit comments

Comments
 (0)