Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Fix parsing of quoted identifiers in SHOW CREATE TABLE queries #737

Merged
merged 2 commits into from
May 31, 2019

Conversation

andremarianiello
Copy link

@andremarianiello andremarianiello commented May 30, 2019

Fixes #733

Signed-off-by: Andre Marianiello <andremarianiello@github.com>
sql/parse/util.go Outdated Show resolved Hide resolved
Signed-off-by: Andre Marianiello <andremarianiello@github.com>
Copy link
Contributor

@kuba-- kuba-- left a comment

Choose a reason for hiding this comment

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

In this case, it's also good to fix parseShowCreate function in parse/show_create.go, because right now we don't split db.table.

@erizocosmico
Copy link
Contributor

@kuba-- in this case SHOW CREATE TABLE ´a.b´ should not be split. Anything inside backticks is an identifier and can't be split. The only reason to have them separated would be a.b or a.b.

@erizocosmico erizocosmico requested a review from a team May 31, 2019 06:50
@kuba--
Copy link
Contributor

kuba-- commented May 31, 2019

if it's a case (that it should not be split) we can just add a dot ('.'), here:
https://github.com/src-d/go-mysql-server/blob/master/sql/parse/util.go#L136
and problem looks as solved.

@erizocosmico
Copy link
Contributor

@kuba-- nope, because when the identifier is not quoted, the dot is not a valid rune for an identifier.

@ajnavarro ajnavarro merged commit 4dcaf78 into src-d:master May 31, 2019
@andremarianiello andremarianiello deleted the fix-quoted-identifiers branch June 12, 2019 18:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot parse "show create table a.b"
4 participants