You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] JSQLParser Version : Postgres : BETWEEN with Cast #2288
Always check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram
Failing SQL Feature:
Using a between expression, with cast doesn't parse correctly
SQL Example:
Simplified Query Example, focusing on the failing feature
SELECT*FROM tbl WHERE
day BETWEEN
CAST(CAST((NOW() + INTERVAL '-30 day') ASdate) AStimestamptz)
AND
CAST(CAST((NOW() + INTERVAL '-1 day') ASdate) AStimestamptz);
Activity
davyboyhayes commentedon Aug 5, 2025
I'm happy to put a PR together, but I'm struggling to work out what I need to change in https://github.com/davyboyhayes/JSqlParser/blob/95ebda5a6112cd79811a63c69ae05be2a8aedc7a/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt#L5749-L5762
manticore-projects commentedon Aug 5, 2025
Greetings!
I believe the LOOKAHEADS need to be changed into Semantic Lookaheads, e.g.:
manticore-projects commentedon Aug 5, 2025
I will fix that tomorrow since I have another case I have to work on.
davyboyhayes commentedon Aug 5, 2025
I've raised #2289. Feel free to ignore it if you have more to build on, but your suggestion results in a passing test for that SQL, thanks!