Skip to content

[BUG] JSQLParser 5.1: PostgreSQL: fail to parse dollar-quoted string constants with tags #2233

Open
@E1izabeth

Description

@E1izabeth

The parser fails to parse dollar-quoted string constants with tags (see https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING)
SQL example:

select
$json$
[
{"some":"json","with":"properties"},
{"other":"json","with":"properties"}
]
$json$::jsonb

The error I get:

net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "::" "::"
    at line 7, column 7.

Was expecting one of:

    <EOF>
    <ST_SEMICOLON>

However, replacing dollar-quotes $json$ with single quotes ' or removing the tag (to leave only double dollar $$) works.

Software Information:

  • JSqlParser 5.1
  • PostgreSQL

Additional information

It used to be supported in JSQLParser 4.5
Connected issue in DBeaver dbeaver/dbeaver#37028

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions