Skip to content

PostgreSQL: Tokenize *= and @@@ as single operators - #3071

Open
ksaiharshavinay wants to merge 2 commits into
apache:mainfrom
ksaiharshavinay:fix/pg-operators-2809
Open

ksaiharshavinay wants to merge 2 commits into
apache:mainfrom
ksaiharshavinay:fix/pg-operators-2809

Conversation

@ksaiharshavinay

Copy link
Copy Markdown

Fixes #2809.

PostgreSqlDialect split *= into Mul + Eq and @@@ into AtAt + AtSign, so statements using them failed to parse or misparsed.

  • Tokenizer: when * is followed by =, <, or > in a dialect with custom operator parts (only PostgreSQL), scan the composite operator (*=, *<, *<=, *<>, *>, *>=) as one CustomBinaryOperator token. The scan stops before a trailing +/-, which PostgreSQL trims from such operators, so a*=-1 stays *= + Minus + 1.
  • The @@ arm now absorbs a third @ into CustomBinaryOperator("@@@"); plain @@ still returns AtAt, and other dialects are unchanged.
  • Tests: tokenizer tests for both operators and the trailing-sign cases, verified_stmt round-trips in sqlparser_postgres (including OPERATOR(pg_catalog.*=) and OPERATOR(pg_catalog.@@@)), plus fuzz seeds per AGENTS.md.

cargo test --all-features: 1984 passed. cargo fmt --check and clippy -D warnings clean.

Disclosure: prepared with AI assistance (Claude), including the review pass.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.64%. Comparing base (3ac3cc3) to head (b989e3e).

Files with missing lines Patch % Lines
src/tokenizer.rs 98.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3071      +/-   ##
==========================================
+ Coverage   83.60%   83.64%   +0.03%     
==========================================
  Files          42       42              
  Lines       35751    35829      +78     
  Branches    35751    35829      +78     
==========================================
+ Hits        29891    29968      +77     
- Misses       2418     2419       +1     
  Partials     3442     3442              

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSqlDialect: *= and @@@ are split into two tokens,

2 participants