-
Notifications
You must be signed in to change notification settings - Fork 129
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersincorrect resultBugs that return incorrect dataBugs that return incorrect datatypesIssues related to type conversionsIssues related to type conversions
Description
Description
DuckDB dates can be further into the past than Postgres dates. We should either truncate the date to the lowest possible date that's representable in Postgres, or we should throw an error. Underflowing and returning a date in the future is the worst possible behavior.
This is a query that creates these underflowing dates:
SELECT * FROM duckdb.query($$
select
'5877642-06-25 (BC)'::date as date,
'290309-12-22 (BC) 00:00:00'::timestamp as timestamp,
'290309-12-22 (BC) 00:00:00'::timestamp_s as timestamp_s,
'290309-12-22 (BC) 00:00:00'::timestamp_ms as timestamp_ms,
'290309-12-22 (BC) 00:17:30+00:17'::timestamptz as timestamptz,
$$);
date │ timestamp │ timestamp_s │ timestamp_ms │ timestamptz
───────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼─────────────────────────────────
5881580-07-14 │ 294247-01-10 08:01:49.551616 │ 294247-01-10 08:01:49.551616 │ 294247-01-10 08:01:49.551616 │ 294247-01-10 09:02:19.551616+01
(1 row)
Example of underflowing dates are in this test:
pg_duckdb/test/regression/expected/test_all_types.out
Lines 42 to 47 in 02ebeae
date | 07-14-5881580 | |
timestamp | Sun Jan 10 08:01:49.551616 294247 | |
timestamp_s | Sun Jan 10 08:01:49.551616 294247 | |
timestamp_ms | Sun Jan 10 08:01:49.551616 294247 | |
timestamp_ns | Wed Sep 22 00:00:00 1677 | |
timestamp_tz | Sun Jan 10 00:01:49.551616 294247 PST |
Found by #577
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersincorrect resultBugs that return incorrect dataBugs that return incorrect datatypesIssues related to type conversionsIssues related to type conversions