-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: improve error message for search_path with commas #53974
Conversation
pkg/sql/vars.go
Outdated
"schema name %q not supported in search_path", s) | ||
return "", unimplemented.NewWithIssuef(53971, | ||
`schema name %q has commas so is not supported in search_path. | ||
Did you mean to omit quotes? SET search_path = %s`, s, s) |
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.
Might be nicer to make this a hint via errors.WithHint
.
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.
I thought about that, but the unimplemented error type already uses a hint... I guess I could use two, or just not make it an unimplemented error, but this way we get telemetry on this hilarious situation.
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.
Hints are made to be chained / combined. We do this in other places too.
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.
Coming back to this several months later - thanks for the suggestion! Done.
It's easy to accidentally surround your search path with quotes when setting it, because you'd think that most things in `SET` syntax are quoted. But you are not supposed to quote things in set search_path, and it can lead to confusing scenarios. Now, if you try to set search_path to a string containing a comma, which we don't support anyway, the error message will be a bit friendlier. Release note (sql change): improve error message when people use set search_path incorrectly, or with a schema that legitimately has a comma in its name Release justification: error-message-only change
159dc25
to
73d3246
Compare
bors r+ |
Build succeeded: |
It's easy to accidentally surround your search path with quotes when
setting it, because you'd think that most things in
SET
syntax arequoted. But you are not supposed to quote things in set search_path, and
it can lead to confusing scenarios. Now, if you try to set search_path
to a string containing a comma, which we don't support anyway, the error
message will be a bit friendlier.
Release note (sql change): improve error message when people use set
search_path incorrectly, or with a schema that legitimately has a comma
in its name
Release justification: error-message-only change