Open ipus1 opened 6 months ago
Thanks for reporting.
This happens because the formatter expects CALL
to be a start of a CALL statement. Similar problem happens with other keywords that mark the start of some statement like SELECT
, UPDATE
, etc.
Even when that particular crash were to be fixed (we could detect that CALL
is followed by .
), this will still leave the problem that call
inside an alias definition would get formatted on a separate line (as again, the formatter assumes it'll start a CALL-statement):
SELECT
call.id as "id"
FROM
c as
call
You might be interested in trying out prettier-plugin-sql-cst, which has a much better support for PostgreSQL (although that support is far from 100%) and doesn't have fundamental problems like this.
Describe the bug When an alias for a table or expression is called "call", the formatter throws an error when trying to access its fields.
Expected behavior Running
should work, but it doesn't. This, however, does:
Actual behavior I got this error:
I assume this might happen for other keywords as well, not only "CALL".
Usage