Skip to content

PostgreSQL, SQLite: Keep untyped string window frame offsets untyped - #2781

Open
LucaCappelletti94 wants to merge 3 commits into
mainfrom
window-frame-untyped-offset
Open

LucaCappelletti94 wants to merge 3 commits into
mainfrom
window-frame-untyped-offset

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

SELECT sum(x) OVER (ORDER BY f RANGE BETWEEN 'inf' PRECEDING AND '1 day' FOLLOWING) FROM t rendered with INTERVAL 'inf' PRECEDING AND INTERVAL '1 day' FOLLOWING in every dialect without require_interval_qualifier. PostgreSQL and SQLite take the type of an untyped offset from the ORDER BY column, so the added INTERVAL changes the statement.

The frame offset is now parsed with parse_expr, dropping the string special case added in #655. INTERVAL '1' DAY PRECEDING still parses as an interval. In the dialects that require an interval qualifier, '1' PRECEDING used to fail and now parses as a string, and '1' DAY PRECEDING without INTERVAL now fails.

https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS and https://www.sqlite.org/windowfunctions.html#frame_boundaries

Yet another PR that has more PR text than code.

@LucaCappelletti94 LucaCappelletti94 added bug Something isn't working PostgreSQL SQLite labels Oct 31, 2026
@codecov-commenter

codecov-commenter commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.88%. Comparing base (7812d86) to head (52d27f6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2781      +/-   ##
==========================================
+ Coverage   82.87%   82.88%   +0.01%     
==========================================
  Files          42       42              
  Lines       35968    35966       -2     
  Branches    35968    35966       -2     
==========================================
+ Hits        29807    29810       +3     
+ Misses       2654     2653       -1     
+ Partials     3507     3503       -4     

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

@LucaCappelletti94
LucaCappelletti94 force-pushed the window-frame-untyped-offset branch from fce98d0 to 52d27f6 Compare October 31, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PostgreSQL SQLite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants