Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite SHOW TABLES #6615

Merged
merged 5 commits into from
Aug 26, 2020
Merged

Conversation

systay
Copy link
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

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
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