JSqlParser
JSqlParser copied to clipboard
[BUG] JSQLParser Version 4.9 : RDBMS Postgresql 14.2 : Using Named Notation
Failing SQL Feature:
When calling a PostgreSQL function, you can use the := operator by specifying the name of each argument.
- The following error occurs when parsing:
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
at line 1, column 29.
Was expecting one of:
"."
"::"
"["
"^"
<EOF>
<ST_SEMICOLON>
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:39603) ~[jsqlparser-4.9.jar!/:na]
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:39427) ~[jsqlparser-4.9.jar!/:na]
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:317) ~[jsqlparser-4.9.jar!/:na]
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:339) ~[jsqlparser-4.9.jar!/:na]
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:336) ~[jsqlparser-4.9.jar!/:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
... 1 common frames omitted
SQL Example:
- Simplified Query Example, focusing on the failing feature
SELECT concat_lower_or_upper(a := 'Hello', uppercase := true, b := 'World');
Software Information:
- JSQLParser 4.9
- PostgreSQL 14.2
Tips:
Newer versions of Postgresql use =>, but you can still use := for backwards compatibility, so I think it should be possible to parse it.
https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html#SQL-SYNTAX-CALLING-FUNCS-NAMED
Greetings.
for named parameters, "=>" is pretty much the established and accepted standard and JSQLParser supports this and Postgres does too.
If you are interested in supporting this legacy Postgres behavior you would need to sponsor or provide an implementation (which does not deteriorate the performance too much -- adding more features to the grammar always comes at a cost unfortunately.)