Thread: timezone offsets and documentation
The documentation says the time with time zone datatype allows zone offsets from +12 to -12. http://www.postgresql.org/docs/8.0/static/datatype-datetime.html This is at odds with the implementation which allows values +1359 to -1359 jurka=# select '00:00:00+1359'::timetz; timetz ---------------- 00:00:00+13:59 (1 row) Further the list of available timezone names says that Etc/GMT-14 is a valid timezone. http://www.postgresql.org/docs/8.0/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE This allows: jurka=# set timezone to 'Etc/GMT-14'; SET jurka=# select '00:00:00'::timetz; timetz ------------- 00:00:00+14 (1 row) but this is not an allowed value: jurka=# select '00:00:00+14'::timetz; ERROR: time zone displacement out of range: "00:00:00+14" Kris Jurka
Kris Jurka <books@ejurka.com> writes: > The documentation says the time with time zone datatype allows zone > offsets from +12 to -12. I see noplace that opines on this at all ... regards, tom lane
On Sun, 6 Feb 2005, Tom Lane wrote: > Kris Jurka <books@ejurka.com> writes: > > The documentation says the time with time zone datatype allows zone > > offsets from +12 to -12. > > I see noplace that opines on this at all ... > http://www.postgresql.org/docs/8.0/static/datatype-datetime.html The reference I provided shows Table 8-9 Date/Time Types: time [ (p) ] with time zone 12 bytes times of day only, with time zone 00:00:00.00+12 23:59:59.99-12 1 microsecond / 14 digits The low value/high value columns seem to me to indicate the +/-12 zone offset range. Kris Jurka
Quite some time ago, Kris Jurka <books@ejurka.com> wrote: > This allows: > jurka=# set timezone to 'Etc/GMT-14'; > SET > jurka=# select '00:00:00'::timetz; > timetz > ------------- > 00:00:00+14 > (1 row) > but this is not an allowed value: > jurka=# select '00:00:00+14'::timetz; > ERROR: time zone displacement out of range: "00:00:00+14" Yeah. It's worse than that actually, because we will take something like SET TIMEZONE TO 'Etc/GMT+15'; I haven't traced through the code but I bet this is being accepted by the "POSIX zone name" rule. Perhaps we should sanity-check the computed offset? I'm not sure what the use of GMT-14 is, but I suggest that we ought to defer to the judgment of the zic people in making it available. Accordingly, we probably ought to modify the range of allowed timezone offsets to allow -14:00 (and maybe +14:00 as well?) Comments? regards, tom lane