Re: Question about "AT TIME ZONE"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Question about "AT TIME ZONE"
Дата
Msg-id 11135.1165352797@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Question about "AT TIME ZONE"  ("Collin Peters" <cadiolis@gmail.com>)
Список pgsql-sql
"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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Din Adrian
Дата:
Сообщение: Re: transaction in function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Can someone explain the problem with this select