You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
date_part is calculating results incorrectly for intervals #14817
SELECT date_part('seconds', interval '1 hour');
-- returns 3600, but the result should be 0SELECT date_part('seconds', interval '1 hour 5 second');
--- returns 3605, should return 5SELECT date_part('seconds', interval '3605 seconds');
--- returns 3605, should return 5
It seems that for intervals at least the date part is calculating based on the overall interval, not the specifically requested part. Postgresql has this note about date_part and interval:
When processing an interval value, the extract function produces field values that match the interpretation used by the interval output function. This can produce surprising results if one starts with a non-normalized interval representation, for example:
SELECT INTERVAL '80 minutes';
Result: 01:20:00
SELECT EXTRACT(MINUTES FROM INTERVAL '80 minutes');
Result: 20
Activity
Omega359 commentedon Feb 21, 2025
It seems that duckdb is also following the interval rules like pg for date_part - https://duckdb.org/docs/sql/data_types/interval.html
velaskuez commentedon Feb 23, 2025
I took a look into this and opened an issue in arrow: apache/arrow-rs#7182
Omega359 commentedon Oct 7, 2025
This issue has been resolved with arrow 55.0.0 via apache/arrow-rs#7189