Skip to content

Create sequence allows dangling NO #1103

Closed
@PartiallyUntyped

Description

@PartiallyUntyped

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions