Skip to content

[BUG] JSQLParser 5.1-SNAPSHOT : PostgreSQL : Fail to parse "COLLATE" in Order By clause #2245

@ldaIas

Description

@ldaIas

Always check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram

Failing SQL Feature:

  • Brief description of the failing SQL feature
  • Example: WITH ROLLUP can't be parsed

"COLLATE" cannot be parsed when used in the Order By clause of a query. For example:
SELECT * FROM a ORDER BY CAST(a.xyz AS TEXT) COLLATE "und-x-icu" ASC NULLS FIRST
produces:
Encountered unexpected token: "COLLATE" "COLLATE" at line 1, column 46. Was expecting one of: <EOF> <ST_SEMICOLON>

SQL Example:

  • Simplified Query Example, focusing on the failing feature
    select *
    from a
    order by cast(a.xyz as text) collate "und-x-icu" asc nulls first

Software Information:

  • JSqlParser version 5.1
  • Postgres 17

Tips:

Please write in English and avoid Screenshots (as we can't copy and paste content from it).
Try your example online with the latest JSQLParser and share the link in the error report.
Do provide Links or References to the specific Grammar and Syntax you are trying to use.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions