Skip to content

Rewrite SHOW TABLES#6615

Merged
harshit-gangal merged 5 commits intovitessio:masterfrom
planetscale:show-tables-dbname
Aug 26, 2020
Merged

Rewrite SHOW TABLES#6615
harshit-gangal merged 5 commits intovitessio:masterfrom
planetscale:show-tables-dbname

Conversation

@systay
Copy link
Copy Markdown
Collaborator

@systay systay commented Aug 24, 2020

When writing a query using SHOW TABLES, a common query is something :

SHOW TABLES FROM keyspace WHERE Tables_in_keyspace = 'table'

because the underlying database does not always use the same database name as the keyspace name, we need to rewrite the query before sending it down to MySQL.

Fixes #6446

systay added 3 commits August 24, 2020 10:44
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Comment on lines -633 to -640
if show.ShowTablesOpt != nil && show.ShowTablesOpt.DbName != "" {
if destKeyspace == "" {
// Change "show tables from <keyspace>" to "show tables" directed to that keyspace.
destKeyspace = show.ShowTablesOpt.DbName
}
show.ShowTablesOpt.DbName = ""
}
sql = sqlparser.String(show)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can revert this change.

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal merged commit 588427c into vitessio:master Aug 26, 2020
@askdba askdba added this to the v8.0 milestone Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix support for show tables where tables_in_db to use keyspace name, not underlying db name

3 participants