Skip to content

WITH keyword panics #270

Closed
Closed
@edwardloveall

Description

@edwardloveall

I saw that a fix for WITH was made in #263, but I have an example that is not a CTE but still crashes:

# echo "CREATE ROLE foo WITH SUPERUSER" > scratch.sql
# ./postgrestools check scratch.sql
Encountered an unexpected error

This is a bug in Postgres Tools, not an error in your code, and we would appreciate it if you could report it along with the following information to help us fixing the issue:

Source Location: crates/pgt_statement_splitter/src/parser.rs:88:9
Thread Name: pgt::worker_5
Message: cannot start statement within statement at Some(Token { kind: With, text: "WITH", span: 16..20, token_type: ReservedKeyword })

scratch.sql internalError/panic  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ processing panicked: cannot start statement within statement at Some(Token { kind: With, text: "WITH", span: 16..20, token_type: ReservedKeyword })
  
  ⚠ This diagnostic was derived from an internal error. Potential bug, please report it if necessary.
  

Checked 0 files in 504µs. No fixes applied.
internalError/io ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ No files were processed in the specified paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions