Re: Timestamp vs timestamptz

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Florian Weimer <fweimer(at)bfk(dot)de>
Cc: Agent M <agentm(at)themactionfaction(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Timestamp vs timestamptz
Date: 2006-07-14 15:00:17
Message-ID: 19896.1152889217@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Florian Weimer <fweimer(at)bfk(dot)de> writes:
> * Agent M.:
>> timestamp with time zone does not record the timezone you inserted it
>> with- it simply stores the GMT version and converts to whatever
>> timezone you like on demand.

> Are you sure? This behavior is not documented, and I can't reproduce
> it with PostgresQL 8.1.4.

Huh? Section 8.5.1.3. Time Stamps says

For timestamp with time zone, the internally stored value is always in
UTC (Universal Coordinated Time, traditionally known as Greenwich Mean
Time, GMT). An input value that has an explicit time zone specified is
converted to UTC using the appropriate offset for that time zone. If no
time zone is stated in the input string, then it is assumed to be in the
time zone indicated by the system's timezone parameter, and is converted
to UTC using the offset for the timezone zone.

and again in section 8.5.3. Time Zones:

All timezone-aware dates and times are stored internally in UTC. They
are converted to local time in the zone specified by the timezone
configuration parameter before being displayed to the client.

There's been some talk of modifying timestamptz to store the original
timezone specification along with the actual value, but at the moment
all it is is a seconds-since-the-epoch numeric value.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2006-07-14 15:18:02 Re: Problem with archive_command
Previous Message Alban Hertroys 2006-07-14 14:18:57 Re: Q: Table scans on set difference