Skip to content

SQLite, PostgreSQL, MySQL: Parse COLLATE as a postfix operator - #3026

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/stacked-collate
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/stacked-collate

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

SELECT a COLLATE NOCASE COLLATE RTRIM FROM t fails with Expected: end of statement, found: RTRIM in every dialect except PostgreSQL, and a stacked COLLATE in an ORDER BY or CREATE INDEX key fails the same way. SQLite, PostgreSQL and MySQL all accept it.

This PR gives COLLATE a default precedence just below ::, which is where PostgreSQL places it, so every dialect reads it as a postfix operator and the one-off check goes away. The new Precedence::Collate variant breaks dialects outside the crate that match Precedence exhaustively.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.54%. Comparing base (46cbf0d) to head (e59278b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3026   +/-   ##
=======================================
  Coverage   83.54%   83.54%           
=======================================
  Files          42       42           
  Lines       35668    35671    +3     
  Branches    35668    35671    +3     
=======================================
+ Hits        29798    29802    +4     
  Misses       2432     2432           
+ Partials     3438     3437    -1     

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

2 participants