-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
ANSI_QUOTES
support for go-mysql-server
#1915
Conversation
…information_schema.ROUTINES support)
…ysql-server into fulghum/ansi_quotes
…ysql-server into fulghum/ansi_quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, nice work!
}, | ||
{ | ||
Query: `show create table view1;`, | ||
Expected: []sql.Row{{"view1", "CREATE VIEW `view1` AS select public_keys.\"public\", public_keys.\"count\" from public_keys", "utf8mb4", "utf8mb4_0900_bin"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this vary from the MySQL behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question... this is slightly different than MySQL's behavior – MySQL will normalize the view definition for the SQL_MODE the session is in. So.... if ANSI_QUOTES
is enabled, then double quotes will be shown around identifiers, otherwise backtick quotes will be shown in the returned definition.
I'll add some skipped tests and document this as a gap in the current support. I'd vote to leave this as a follow-up, but let me know if you think it's higher priority than that.
I also tested procedures, triggers, and events, and this normalization seems to be unique to views. Procedures, triggers, and events do not get changed to match the session's current ANSI_QUOTES setting, which sorta makes sense given that show create table
feels slightly higher level than show routines
, etc (which seem to just directly return information_schema rows).
Now that our parser has support for parsing in ANSI_QUOTES mode and treating double quotes as identifier quotes, this PR starts using that support when we parse queries. The main changes in this PR are:
SqlMode
type to make it easier to load SQL_MODE and inspect enabled modes.Dolt has a similar, corresponding PR: dolthub/dolt#6465
Related to: dolthub/dolt#6305