Skip to content

Create sequence allows dangling NO #1103

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

Closed
PartiallyUntyped opened this issue Jan 20, 2024 · 0 comments · Fixed by #1104
Closed

Create sequence allows dangling NO #1103

PartiallyUntyped opened this issue Jan 20, 2024 · 0 comments · Fixed by #1104

Comments

@PartiallyUntyped
Copy link
Contributor

PartiallyUntyped commented Jan 20, 2024

I was writing a PR for #1102, and I found a bug where a dangling No slips through in create sequence options

https://github.com/sqlparser-rs/sqlparser-rs/blob/b0b62887a2bbc464642a17e590b259411bf1c11d/src/parser/mod.rs#L8604-L8611

If a No is consumed, the case where nothing exists isn't handled.

This should be

if self.parse_keywords(&[Keyword::NO, Keyword::CYCLE]) {
    sequence_options.push(SequenceOptions::Cycle(true));
} else if self.parse_keywords(&[Keyword::CYCLE]) {
    sequence_options.push(SequenceOptions::Cycle(false));
}

I will open a PR.

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 a pull request may close this issue.

1 participant