pgjdbc-ng
pgjdbc-ng copied to clipboard
Error parsing $N args within parens
Simple repro
PREPARE test_plan AS SELECT hashtext($1)
This is legal PSQL, libpq, etc. all allow it. pgjdbc-ng throws this error:
Error parsing SQL at position 40 (PREPARE test_plan AS SELECT hashtext($1)): Error near:
Interestingly, pgjdbc-ng does not throw on this similar query:
PREPARE test_plan AS SELECT $1
My company came across this after we introduced a new grammar for shredding JSON, which is biased towards $ expressions without quoting, embracing JSON Path, etc. The syntax we have looks like this:
select * from flatten('{"a":1,"b":2}', $ as root) as f
We are very keen to support this feature of our own in our product, which includes a query editor that uses pgdjbc-ng. Unfortunately our own product can't execute its native JSON grammar without a fix here.