Skip to content

Commit 54f63e2

Browse files
committed
Merge branch 'main' into max/parser-simple-union
2 parents f4650ba + 7c0788f commit 54f63e2

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)