Skip to content

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

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.

Activity

  1. changed the title [-][BUG] JSQLParser 5.1-SNAPSHOT : RDBMS : Fail to parse "COLLATE" in Order By clause[/-] [+][BUG] JSQLParser 5.1-SNAPSHOT : PostgreSQL : Fail to parse "COLLATE" in Order By clause[/+] on May 22, 2025
  2. manticore-projects commented on May 25, 2025

    @manticore-projects
    Contributor

    Unsupported and you will need to either provide a PR or sponsor an implementation.

  3. ldaIas commented on Jul 10, 2025

    @ldaIas
    ContributorAuthor

    Created PR: #2277

  4. manticore-projects commented on Mar 15, 2026

    @manticore-projects
    Contributor

    Solved, you can verify here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions