postgres-language-server icon indicating copy to clipboard operation
postgres-language-server copied to clipboard

WITH keyword panic's

Open edwardloveall opened this issue 8 months ago • 1 comments

I saw that a fix for WITH was made in https://github.com/supabase-community/postgres-language-server/pull/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.

edwardloveall avatar Mar 29 '25 17:03 edwardloveall

we need to publish a new release for the fix to be available. We will do so latest Monday.

Unfortunately, we did not set up nightly releases yet. If you don't want to wait, you can build from source.

Thanks for trying it out!

psteinroe avatar Mar 29 '25 18:03 psteinroe

after some upstream issues have been resolved, we finally released a new version that includes this fix. Sorry for the delay!

psteinroe avatar Apr 03 '25 14:04 psteinroe