Re: more timeofday() and "set time zone" weirdness

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jason_priebe(at)yahoo(dot)com (Jason Priebe)
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: more timeofday() and "set time zone" weirdness
Date: 2003-08-13 20:14:15
Message-ID: 10820.1060805655@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

jason_priebe(at)yahoo(dot)com (Jason Priebe) writes:
> foo=> select cast(timeofday() as timestamp with time zone); set time
> zone 'GMT+4'; select cast(timeofday() as timestamp with time zone);

This breaks because localtime() is broken: it returns the string "GMT"
as the time zone. You can see the problem without any reference to
Postgres:

$ date
Wed Aug 13 16:09:56 EDT 2003
$ TZ='GMT+4' date
Wed Aug 13 16:09:57 GMT 2003
$

My advice: don't specify the time zone like that. Use 'EST5EDT' or some
other standard timezone specifier. Or avoid timeofday() ... now() or
current_timestamp would be better choices anyway ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-08-13 20:15:53 Re: Commercial support?
Previous Message Jason Godden 2003-08-13 20:02:23 Re: The database is very slow !