diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-05-30 19:58:35 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-05-30 19:58:35 -0400 |
commit | cd0ff9c0f47784b428981280cd9564bb79a8266a (patch) | |
tree | fd4b4f443db074caab0b8e93a1feca140c1eb375 /src/backend/utils/adt/datetime.c | |
parent | 07ab1383e3be9e6f368e2ceb11bf7697d88260f9 (diff) | |
download | postgresql-cd0ff9c0f47784b428981280cd9564bb79a8266a.tar.gz |
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/datetime.c')
-rw-r--r-- | src/backend/utils/adt/datetime.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 31ae045da9..d5d34da552 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -2698,9 +2698,6 @@ DecodeNumberField(int len, char *str, int fmask, * Return 0 if okay (and set *tzp), a DTERR code if not okay. * * NB: this must *not* ereport on failure; see commands/variable.c. - * - * Note: we allow timezone offsets up to 13:59. There are places that - * use +1300 summer time. */ static int DecodeTimezone(char *str, int *tzp) @@ -2745,7 +2742,8 @@ DecodeTimezone(char *str, int *tzp) else min = 0; - if (hr < 0 || hr > 14) + /* Range-check the values; see notes in datatype/timestamp.h */ + if (hr < 0 || hr > MAX_TZDISP_HOUR) return DTERR_TZDISP_OVERFLOW; if (min < 0 || min >= MINS_PER_HOUR) return DTERR_TZDISP_OVERFLOW; |