-
Notifications
You must be signed in to change notification settings - Fork 30
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] Kill NameArgs.Escape
#484
Conversation
DestKind constants.DestinationKind | ||
} | ||
|
||
// symbolsToEscape are additional keywords that we need to escape | ||
var symbolsToEscape = []string{":"} | ||
|
||
func EscapeNameIfNecessary(name string, uppercaseEscNames bool, args *NameArgs) string { | ||
if args == nil || !args.Escape { |
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.
Is this safe? What about callers that expect the column to not be escaped?
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.
There aren't any callers that expect this column not to be escaped.
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.
args.Escape
is always true.
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.
Cool
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.
Do you want to kill NameArgs and just pass DestKind?
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, and that's what I originally wanted to do, but it's a little tricky because sometimes args
is null and it's annoying to create a pointer to DestinationKind
. Maybe I'll do that anyways since it's a bit safer.
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.
Tried again and it ends up being a bigger lift than I want to do right now, will look into it some other time.
Escape
is always true for non-test code and only ever false in test code.