JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

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

Open ldaIas opened this issue 6 months ago • 1 comments

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.

ldaIas avatar May 22 '25 19:05 ldaIas

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

manticore-projects avatar May 25 '25 09:05 manticore-projects

Created PR: https://github.com/JSQLParser/JSqlParser/pull/2277

ldaIas avatar Jul 10 '25 23:07 ldaIas