Re: postgres UTC different from perl?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: postgres UTC different from perl?
Date: 2007-12-20 01:14:17
Message-ID: 1685.1198113257@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton <dev(at)archonet(dot)com> writes:
> I'm not sure that (CURRENT_DATE AT TIME ZONE 'UTC') does what you think
> it does. Try setting your timezone to various offsets and exploring.

In fact, I think it's adjusting in exactly the wrong direction.

I get the right number from

regression=# select date_part('epoch', 'today'::timestamp at time zone 'UTC');
date_part
------------
1198022400
(1 row)

and the wrong one from

regression=# select date_part('epoch', 'today'::timestamptz at time zone 'UTC');
date_part
------------
1198058400
(1 row)

and I think the locution with CURRENT_DATE is equivalent to the second
case because timestamptz is the preferred type to promote date to.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2007-12-20 01:27:58 Re: pgpool and slony
Previous Message Tom Lane 2007-12-20 00:53:48 Re: pgpool and slony