Describe the bug
check panics on a valid query when a WITH keyword is followed by a blank line and
the CTE definition is indented. The panic aborts the whole run, so a single file of this
shape stops check from finishing over a directory.
This is the same assertion as the already-closed #303, but a different trigger, and it
reproduces on 0.25.7.
To Reproduce
repro.sql (4 lines, note the leading whitespace on line 3):
WITH
x AS (SELECT 1 AS a)
SELECT x.a FROM x;
$ postgres-language-server check repro.sql
Encountered an unexpected error
Source Location: crates/pgls_text_size/src/range.rs:50:9
Thread Name: main
Message: assertion failed: start.raw <= end.raw
Both conditions are required. Removing either one avoids the panic:
| Input |
Result |
WITH + blank line + indented CTE (tab, 1 space or 4 spaces) |
panic |
WITH + blank line + unindented CTE |
no panic |
WITH + no blank line + indented CTE |
no panic |
Expected behavior
No panic. A diagnostic is fine, a crash is not, especially since it terminates the run
and leaves the remaining files unchecked.
System information
- postgres-language-server 0.25.7
- macOS (aarch64), release binary
postgres-language-server_aarch64-apple-darwin
Describe the bug
checkpanics on a valid query when aWITHkeyword is followed by a blank line andthe CTE definition is indented. The panic aborts the whole run, so a single file of this
shape stops
checkfrom finishing over a directory.This is the same assertion as the already-closed #303, but a different trigger, and it
reproduces on 0.25.7.
To Reproduce
repro.sql(4 lines, note the leading whitespace on line 3):Both conditions are required. Removing either one avoids the panic:
WITH+ blank line + indented CTE (tab, 1 space or 4 spaces)WITH+ blank line + unindented CTEWITH+ no blank line + indented CTEExpected behavior
No panic. A diagnostic is fine, a crash is not, especially since it terminates the run
and leaves the remaining files unchecked.
System information
postgres-language-server_aarch64-apple-darwin