Skip to content

Error parsing $N args within parens #608

@kwesterfeld2

Description

@kwesterfeld2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions