Skip to content

Oracle: Support caret not-equal operator (^=) - #3086

Open
BenSatori wants to merge 2 commits into
apache:mainfrom
BenSatori:oracle-gap-12-caret-not-equal
Open

BenSatori wants to merge 2 commits into
apache:mainfrom
BenSatori:oracle-gap-12-caret-not-equal

Conversation

@BenSatori

Copy link
Copy Markdown
Contributor

Dialects: Oracle

SELECT 1 FROM dual WHERE (1,2) ^= ((1,3)) currently fails with:
Expected: an expression, found: = at Line: 1, Column: 33

Oracle accepts ^= as an alternate spelling of the not-equal operator, alongside != and <>.
Syntax reference: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Comparison-Conditions.html

This PR adds Dialect::supports_caret_not_equal() (default false, true for OracleDialect). When enabled, the tokenizer emits the existing Token::Neq for a contiguous ^=, so it parses as BinaryOperator::NotEq and displays as <>. No AST changes. Other dialects are unaffected, and ^ = with whitespace is still rejected.

Tests in tests/sqlparser_oracle.rs cover the AST shape, display normalization (^= → <>) for scalar, tuple, and CASE usages, and exact error messages for the non-contiguous form and for dialects without support.

Fuzzed with fuzz_parse_sql and fuzz_parse_roundtrip for 60 seconds each, no panics. Seed: fuzz/fuzz_seeds/oracle_caret_not_equal.sql.

This PR was written with AI assistance (Claude Code). I reviewed every line and can explain each change.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the Oracle label Dec 1, 2026
@codecov-commenter

codecov-commenter commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.65%. Comparing base (540e398) to head (98fa3f6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3086   +/-   ##
=======================================
  Coverage   83.64%   83.65%           
=======================================
  Files          42       42           
  Lines       35833    35841    +8     
  Branches    35833    35841    +8     
=======================================
+ Hits        29974    29982    +8     
  Misses       2418     2418           
  Partials     3441     3441           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tests/sqlparser_oracle.rs Outdated
.parse_sql_statements("SELECT id FROM t WHERE id ^ = 1")
.unwrap_err()
.to_string(),
"sql parser error: Expected: an expression, found: ="

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use typed errors instead of the to_string, likely you can also drop the unwrap_err

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: both negative tests now compare against Err(ParserError::ParserError(...)) directly, no unwrap_err/to_string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants