pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Collin Peters <cadiolis@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Question about "AT TIME ZONE"
Date: Tue, 05 Dec 2006 16:06:37 -0500
Message-ID: <11135.1165352797@sss.pgh.pa.us> (raw)
In-Reply-To: <df01c91b0612051229n21d98f49pd353779a6316b800@mail.gmail.com>
References: <df01c91b0612051229n21d98f49pd353779a6316b800@mail.gmail.com>

"Collin Peters" <cadiolis@gmail.com> writes:
> In the first example it says it is converted to PST "for display".  In
> the second example it is not converted to PST for display.  Does this
> mean that if a timestamp *with* a timezone is specified, and it also
> includes "AT TIME ZONE", that it is not converted to PST "for display"
> at the end?

AT TIME ZONE does two different things that are sort of inverses of each
other: it can convert timestamp without timezone to timestamp with
timezone, or the reverse.  In the case where you're converting to ts
with tz, there's an additional step involved, which is converting the
UTC-base ts-with-tz value to your current TimeZone for display.  That
happens when SELECT emits the value as text, not as part of AT TIME ZONE.

AT TIME ZONE itself basically either adds or subtracts the UTC offset of
the named time zone, thus converting a value in UTC to or from a value
that's relative to the named zone.

			regards, tom lane



view thread (2+ messages)

Message-ID: <11135.1165352797@sss.pgh.pa.us>
Permalink:  ../11135.1165352797@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11135.1165352797@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cadiolis@gmail.com
  Subject: Re: Question about "AT TIME ZONE"
  In-Reply-To: <11135.1165352797@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox