diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-12-28 22:49:57 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-12-28 22:50:19 -0500 |
| commit | 0fdf735d977de99551dd4d7910bdc4d75a08608d (patch) | |
| tree | a03b80e62c151106a9eee8adbf571d7cd1f09364 /src/include | |
| parent | a45e2e141d5002866f60b6f28f14d00317c106d1 (diff) | |
Avoid unexpected conversion overflow in planner for distant date values.
The "date" type supports a wider range of dates than int64 timestamps do.
However, there is pre-int64-timestamp code in the planner that assumes that
all date values can be converted to timestamp with impunity. Fortunately,
what we really need out of the conversion is always a double (float8)
value; so even when the date is out of timestamp's range it's possible to
produce a sane answer. All we need is a code path that doesn't try to
force the result into int64. Per trouble report from David Rericha.
Back-patch to all supported versions. Although this is surely a corner
case, there's not much point in advertising a date range wider than
timestamp's if we will choke on such values in unexpected places.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/utils/date.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/date.h b/src/include/utils/date.h index 98570e663c0..227a7c897e0 100644 --- a/src/include/utils/date.h +++ b/src/include/utils/date.h @@ -91,6 +91,8 @@ typedef struct /* date.c */ +extern double date2timestamp_no_overflow(DateADT dateVal); + extern Datum date_in(PG_FUNCTION_ARGS); extern Datum date_out(PG_FUNCTION_ARGS); extern Datum date_recv(PG_FUNCTION_ARGS); |
