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 5.4-SNAPSHOT : PostgreSQL : jsonb operator "?" fails together with JDBC named parameters (regression via #2466) #2475
Using the PostgreSQL jsonb existence operator ? in a condition that also contains a JDBC named parameter (:name).
The ternary lookahead introduced with the ClickHouse ternary support (#2466) treats any standalone : at bracket depth 0 as the ternary else separator. A JDBC named parameter starts with exactly the same : token, so the parser commits to the ternary reading of the ? and then fails waiting for its closing :.
SQL Example:
SELECT*FROM t WHERE j ? :key
SELECT*FROM t WHERE j ? 'k'AND x = :p
Both throw a JSQLParserException on current master, although SELECT * FROM t WHERE j ? 'k' (no named parameter) and SELECT * FROM t WHERE x = :p (no ?) each parse fine. Both statements parsed fine on the commit right before #2466 (verified on 2989cb1: j ? :key parses as a JsonOperator with a named parameter operand), so this is a regression introduced by #2466.
The ternary else separator can only follow a token which can END an expression (identifier, literal, JDBC parameter, balanced closing bracket), because the then-branch must be a complete expression. A : in operand position (directly after an operator such as =, AND, or directly after the leading ?) starts a named parameter instead and must not close the then-branch.
Activity