Re: Timestamp to time_t - Mailing list pgsql-hackers

From David Fetter
Subject Re: Timestamp to time_t
Date
Msg-id 20090915153219.GC19673@fetter.org
Whole thread Raw
In response to Re: Timestamp to time_t  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Timestamp to time_t
List pgsql-hackers
On Tue, Sep 15, 2009 at 11:02:52AM -0400, Tom Lane wrote:
> David Fetter <david@fetter.org> writes:
> > I've looked through SQL:2008 (well, through
> > 6WD2_02_Foundation_2007-12.pdf), and I didn't find anything that
> > implies that the input time zone needs to be retrievable, nor
> > anything that would specify the syntax for doing so.
> 
> EXTRACT()?

I see that EXTRACT() can take a time zone as input, but I don't see
anywhere that could distinguish among the following inputs, once
stored, as they have identical representations in UTC:

SELECT   now() AS "West Oakland",   now() AT TIME ZONE 'UTC' AS "Greenwich",   now() AT TIME ZONE 'Asia/Shanghai' AS
"Pudong";       West Oakland          |         Greenwich          |            Pudong           
 
-------------------------------+----------------------------+----------------------------2009-09-15 08:27:00.306403-07
|2009-09-15 15:27:00.306403 | 2009-09-15 23:27:00.306403
 
(1 row)

The way we store TIMESTAMP WITH TIME ZONE, the database converts to
UTC, discarding the input time zone in the process.  SQL:2008 appears
to allow this, and doesn't appear to have a way to retrieve that input
time zone once a TIMESTAMP WITH TIME ZONE field has been stored.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: PGCluster-II Progress
Next
From: Tom Lane
Date:
Subject: Re: errcontext support in PL/Perl