JSqlParser
JSqlParser copied to clipboard
Unable to wrap expression in brackets
Bug
The following (Postgres?) queries cannot be parsed:
SELECT (integer '1');
-- Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "\'1\'" <S_CHAR_LITERAL>
-- at line 1, column 17.
SELECT * FROM tmp2 WHERE col between (date '01-01-2010') and (date '02-01-2010' + integer '1');
-- Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "between" "BETWEEN"
-- at line 1, column 30.
SELECT * FROM tmp2 WHERE col between (select (date '01-01-2010')) and (select (date '02-01-2010' + integer '1'));
-- Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "between" "BETWEEN"
-- at line 1, column 30.
It looks like all the queries are because of the same bug but I included all of them just in case.
System
- Java Version 11
- JSqlParser version 3.1
This looks strange. Brackets should it be the problem my first guess is this integer 1 thing.
Postgres implicit casts are not supported.
Explicit cast will work:
SELECT ( '1'::integer )
;
SELECT CAST('1' AS integer)
;
Duplicate of #1344
I am closing this since it is not support and won't be supported (unless any genius provided a PR).