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

[sql] Kill NameArgs.Escape #484

Merged
merged 3 commits into from
Apr 22, 2024
Merged

[sql] Kill NameArgs.Escape #484

merged 3 commits into from
Apr 22, 2024

Conversation

nathan-artie
Copy link
Contributor

@nathan-artie nathan-artie commented Apr 22, 2024

Escape is always true for non-test code and only ever false in test code.

@nathan-artie nathan-artie requested a review from Tang8330 April 22, 2024 20:53
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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

@nathan-artie nathan-artie Apr 22, 2024

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.

@nathan-artie nathan-artie merged commit 1136a3d into master Apr 22, 2024
1 check passed
@nathan-artie nathan-artie deleted the nv/kill-name-args.escape branch April 22, 2024 21:26
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.

2 participants