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 : Oracle : PRIOR silently dropped on non-comparison conditions (BETWEEN / LIKE / IS NULL / IN ...) #2601
Title: [BUG] JSQLParser 5.4-SNAPSHOT : Oracle : PRIOR silently dropped on non-comparison conditions (BETWEEN / LIKE / IS NULL / IN ...)
AI disclosure: this issue was prepared with AI coding agents, reviewed and revised line by line by me.
Failing SQL Feature:
The Oracle PRIOR unary operator is consumed but then silently lost when the condition it applies to is not a comparison: BETWEEN, LIKE / NOT LIKE, SIMILAR TO, IS [NOT] NULL, IS [NOT] TRUE, IS [NOT] UNKNOWN, IS DISTINCT FROM, MEMBER OF all parse successfully but deparse without PRIOR, silently inverting the semantics of hierarchical-query filters.
PRIOR a IN (1, 2) is worse: it throws IllegalArgumentException: unexpected prior for oracle found at parse time.
Additionally, comparisons keep PRIOR in toString() but lose it through the deparser round-trip (PRIOR a = b deparses as a = b).
Out of scope here but related: a BETWEEN PRIOR 1 AND 2 (PRIOR on the BETWEEN start operand) is a plain ParseException, a separate grammar gap.
SQL Example:
SELECT*FROM emp WHERE PRIOR empno BETWEEN 100AND200;
-- parses OK, deparse / toString: "SELECT * FROM emp WHERE empno BETWEEN 100 AND 200" (PRIOR lost)SELECT*FROM emp WHERE PRIOR ename LIKE'S%';
-- same silent lossSELECT*FROM emp WHERE PRIOR deptno IN (10, 20);
-- net.sf.jsqlparser.parser... IllegalArgumentException: unexpected prior for oracle foundSELECT*FROM emp WHERE PRIOR empno = mgr;
-- toString keeps PRIOR, deparser round-trip loses it
Software Information:
JSqlParser version: 5.4-SNAPSHOT (master 7cc86386; same behavior on 4.x/5.x era commits)
Database: Oracle
Tips:
Root cause: Condition() consumes the leading PRIOR token and only propagates ORACLE_PRIOR_START onto the parsed condition when it instanceof SupportsOldOracleJoinSyntax; the classes above do not implement the interface, InExpression implements it but rejects any position other than NO_ORACLE_PRIOR, and deparse(OldOracleJoinBinaryExpression, ...) renders the (+) marks but not the PRIOR marks.
PRIOR on a comparison operand already round-trips through the AST (PRIOR a = b keeps it in toString()), so the fix direction is to give the remaining condition classes the same SupportsOldOracleJoinSyntax treatment, as ComparisonOperator and InExpression (for (+)) already have.
Activity
fix(parser): preserve Oracle PRIOR position on all condition expressi…