Skip to content

SQLite: Group LIKE, GLOB, MATCH and REGEXP with = - #3070

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/sqlite-like-glob-precedence
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/sqlite-like-glob-precedence

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

Under SQLiteDialect, a GLOB 'p' = 1 parsed as a GLOB ('p' = 1). SQLite's grammar puts LIKE, GLOB, MATCH and REGEXP on the same left-associative level as = and <> (parse.y, %left IS MATCH LIKE_KW BETWEEN IN ISNULL NOTNULL NE EQ), and sqlite3 returns 1 for SELECT 'a' GLOB 'a' = 1, which only the left-grouped reading gives. This came up in review on #3043 (comment).

The dialect ranked Precedence::Like one step below Precedence::Eq, so the pattern operand absorbed a following =, <>, BETWEEN or IN. Moving Precedence::Like to the level of Precedence::Eq in SQLiteDialect::prec_value regroups every operator that takes its level from that lookup, the NOT forms and the ESCAPE operand included. Other dialects keep their own tables.

@LucaCappelletti94 LucaCappelletti94 added bug Something isn't working SQLite labels Nov 28, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.59%. Comparing base (ca4383f) to head (c35201a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3070      +/-   ##
==========================================
- Coverage   83.59%   83.59%   -0.01%     
==========================================
  Files          42       42              
  Lines       35732    35731       -1     
  Branches    35732    35731       -1     
==========================================
- Hits        29871    29870       -1     
  Misses       2420     2420              
  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.

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

Labels

bug Something isn't working SQLite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants