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

fix(parser): disallow empty object names #8171

Merged
merged 7 commits into from Feb 26, 2023

Conversation

broccoliSpicy
Copy link
Contributor

@broccoliSpicy broccoliSpicy commented Feb 24, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Fix #6022

Checklist For Contributors

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features).
  • I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Checklist For Reviewers

  • [ ] I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

  • My PR DOES NOT contain user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

@xxchan xxchan changed the title fix(parser): issue 6022, empty object names are allowed fix(parser): disallow empty object names Feb 25, 2023
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Thanks for your contribution!

src/sqlparser/src/ast/mod.rs Outdated Show resolved Hide resolved
src/sqlparser/src/ast/mod.rs Outdated Show resolved Hide resolved
src/sqlparser/src/ast/mod.rs Outdated Show resolved Hide resolved
where
S: Into<String>,
{
assert!(quote == '\'' || quote == '"' || quote == '`' || quote == '[');
Copy link
Member

Choose a reason for hiding this comment

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

I think we can keep the assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, if the function name is _unchecked, doesn't seem coherent to add assertions.

Ident {
value: value.into(),
quote_style: Some(quote),
}
}

/// Create a new quoted identifier with the given quote and value.
/// returns ParserError when the given string is empty or the given quote is illegal.
pub fn new_with_quote_check<S>(quote: char, value: S) -> Result<Ident, ParserError>
Copy link
Member

Choose a reason for hiding this comment

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

Where is this function used? I didn't find that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shoud I remove this function? it might be useful, and I just found this asymmetry jarring defining only a unchecked function

@xxchan xxchan added this pull request to the merge queue Feb 26, 2023
Merged via the queue into risingwavelabs:main with commit 500cdf4 Feb 26, 2023
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.

bug: empty object names are allowed
2 participants