summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/date.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-05-30 19:58:47 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-05-30 19:58:47 -0400
commit9b0875a2045cecc9de2a0f1c16e7930510a394ae (patch)
tree7a7bb36e7d599adcd8fcf0b7440e4a409c0ee646 /src/backend/utils/adt/date.c
parentb1d01f9a8984f21865e3d9cc9830900db8f91a06 (diff)
Expand the allowed range of timezone offsets to +/-15:59:59 from Greenwich.
We used to only allow offsets less than +/-13 hours, then it was +/14, then it was +/-15. That's still not good enough though, as per today's bug report from Patric Bechtel. This time I actually looked through the Olson timezone database to find the largest offsets used anywhere. The winners are Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42 until 1867. So we'd better allow offsets less than +/-16 hours. Given the history, we are way overdue to have some greppable #define symbols controlling this, so make some ... and also remove an obsolete comment that didn't get fixed the last time. Back-patch to all supported branches.
Diffstat (limited to 'src/backend/utils/adt/date.c')
-rw-r--r--src/backend/utils/adt/date.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index c97ecf4a1ad..c10931317ef 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -1924,9 +1924,8 @@ timetz_recv(PG_FUNCTION_ARGS)
result->zone = pq_getmsgint(buf, sizeof(result->zone));
- /* we allow GMT displacements up to 14:59:59, cf DecodeTimezone() */
- if (result->zone <= -15 * SECS_PER_HOUR ||
- result->zone >= 15 * SECS_PER_HOUR)
+ /* Check for sane GMT displacement; see notes in utils/timestamp.h */
+ if (result->zone <= -TZDISP_LIMIT || result->zone >= TZDISP_LIMIT)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE),
errmsg("time zone displacement out of range")));