JSqlParser
JSqlParser copied to clipboard
subtract int from date doesn't work
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
SELECT true WHERE '2001-09-28' < date '2001-09-28' + integer '7'- Parsing this SQL using JSqlParser with this statements
- Exception
org.junit.ComparisonFailure: Expected query to parse but it failed to parse (error: Encountered unexpected token: "\'7\'" <S_CHAR_LITERAL>
at line 1, column 62.
Expected behavior
query to parse according to https://www.postgresql.org/docs/9.1/functions-datetime.html, but it doesn't
alternative SELECT true WHERE '2001-09-28' < date '2001-09-28' + interval '7 days' works but it's not of type date anymore
System
- Postgres
- Java 11
- JSqlParser 4.2
I can only repeat what I have explained before: JSQLParser does not support implicit casting like integer '7'. Explicit casting Cast('7' AS integer) or '7'::integer will work.
Duplicate of #1344
I am closing this since it is not support and won't be supported (unless any genius provided a PR).