Skip to content

PostgreSQL: Keep the precision of typed interval literals - #2782

Open
LucaCappelletti94 wants to merge 4 commits into
mainfrom
pg-interval-typed-literal-precision
Open

LucaCappelletti94 wants to merge 4 commits into
mainfrom
pg-interval-typed-literal-precision

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

SELECT interval(2) '1 day 01:23:45.6789' rendered as SELECT INTERVAL '1 day 01:23:45.6789', and PostgreSQL rounds the value differently without the precision. This fixes the PostgreSQL case of #2763. The generic INTERVAL (100) MINUTE case in the same issue already round-trips on main.

When the typed literal path sees INTERVAL with fields or a precision, it now builds a typed string with that DataType::Interval, rendered as INTERVAL(2) '...'.

https://www.postgresql.org/docs/current/datatype-datetime.html

@LucaCappelletti94 LucaCappelletti94 added bug Something isn't working PostgreSQL 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 83.09%. Comparing base (1071d75) to head (c96bc9e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2782   +/-   ##
=======================================
  Coverage   83.09%   83.09%           
=======================================
  Files          42       42           
  Lines       36261    36265    +4     
  Branches    36261    36265    +4     
=======================================
+ Hits        30130    30134    +4     
  Misses       2636     2636           
  Partials     3495     3495           

☔ 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 pg-interval-typed-literal-precision branch from 7278ff6 to f24a6a4 Compare November 2, 2026 14:17
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants