AT TIME ZONE with full timezones

Started by Magnus Haganderabout 21 years ago4 messagespatches
Jump to latest
#1Magnus Hagander
magnus@hagander.net

This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Docs updates forthcoming assuming this approach is considered good ;-)

//Magnus

Attachments:

timezones.patchapplication/octet-stream; name=timezones.patchDownload+231-225
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: AT TIME ZONE with full timezones

"Magnus Hagander" <mha@sollentuna.net> writes:

This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available.

Docs updates forthcoming assuming this approach is considered good ;-)

Looks reasonable to me, please supply docs.

regards, tom lane

#3Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#2)
Re: AT TIME ZONE with full timezones

This patch makes it possible to use the full set of timezones when
doing "AT TIME ZONE", and not just the shorlist previously

available.

Docs updates forthcoming assuming this approach is

considered good ;-)

Looks reasonable to me, please supply docs.

Great. Here is a doc patch. Turns out there were less mentions of this
than I thought, so the patch is pretty small.

//Magnus

Attachments:

timezone.doc.patchapplication/octet-stream; name=timezone.doc.patchDownload+11-11
#4Bruce Momjian
bruce@momjian.us
In reply to: Magnus Hagander (#1)
Re: AT TIME ZONE with full timezones

Patch applied. Thanks. Doc updates applied too.

---------------------------------------------------------------------------

Magnus Hagander wrote:

This patch makes it possible to use the full set of timezones when doing
"AT TIME ZONE", and not just the shorlist previously available. For
example:

SELECT CURRENT_TIMESTAMP AT TIME ZONE 'Europe/London';

works fine now. It will also obey whatever DST rules were in effect at
just that date, which the previous implementation did not.

It also supports the AT TIME ZONE on the timetz datatype. The whole
handling of DST is a bit bogus there, so I chose to make it use whatever
DST rules are in effect at the time of executig the query. not sure if
anybody is actuallyi *using* timetz though, it seems pretty
unpredictable just because of this...

Docs updates forthcoming assuming this approach is considered good ;-)

//Magnus

Content-Description: timezones.patch

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073