From a881864cab56d7ebccbedc50527923b5197aaf30 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Wed, 9 Oct 2024 15:34:25 -0700 Subject: [PATCH 1/2] Added schema to SHOW COLUMNS --- sql/planbuilder/show.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sql/planbuilder/show.go b/sql/planbuilder/show.go index f7325ebadd..38d513cc98 100644 --- a/sql/planbuilder/show.go +++ b/sql/planbuilder/show.go @@ -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) From 16d1ab3a3e7711ca696e97f18ec92b95226a9fa0 Mon Sep 17 00:00:00 2001 From: zachmu Date: Wed, 9 Oct 2024 23:01:38 +0000 Subject: [PATCH 2/2] [ga-format-pr] Run ./format_repo.sh to fix formatting --- sql/planbuilder/show.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/planbuilder/show.go b/sql/planbuilder/show.go index 048cfce1bc..a67e3c29cd 100644 --- a/sql/planbuilder/show.go +++ b/sql/planbuilder/show.go @@ -723,11 +723,11 @@ func (b *Builder) buildShowAllColumns(inScope *scope, s *ast.Show) (outScope *sc } else if s.Table.DbQualifier.String() != "" { dbName = s.Table.DbQualifier.String() } - + 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())