From: Tom Lane <tgl@sss.pgh.pa.us>
To: duncan.stokes@eyemagnet.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14082: Unexpected time adjustment for output using "at time zone"
Date: Mon, 11 Apr 2016 18:49:19 -0400
Message-ID: <13349.1460414959@sss.pgh.pa.us> (raw)
In-Reply-To: <20160410220738.15199.93161@wrigleys.postgresql.org>
References: <20160410220738.15199.93161@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
duncan.stokes@eyemagnet.com writes:
> For the following data:
> datetimetest=# SELECT * FROM datetimetest_log;
> id | datetime | comment
> ----+------------------------+---------
> 1 | 2016-04-11 09:51:35+12 | Test #1
> 2 | 2016-04-11 09:51:37+12 | Test #2
> (2 rows)
> Get the following responses:
> datetimetest=# SELECT datetime AT TIME ZONE INTERVAL '+12:00' FROM
> datetimetest_log;
> timezone
> ---------------------
> 2016-04-11 09:51:35
> 2016-04-11 09:51:37
> (2 rows)
> datetimetest=# SELECT datetime AT TIME ZONE '+12' FROM datetimetest_log;
> timezone
> ---------------------
> 2016-04-10 09:51:35 ** WRONG DATE FOR +12 ZONE **
> 2016-04-10 09:51:37 ** WRONG DATE FOR +12 ZONE **
> (2 rows)
No, it isn't wrong. A time zone specified by an INTERVAL constant
follows the ISO8601 convention that positive offsets are east of
Greenwich; and that's also the convention we use when displaying
timestamptz values, so your first two sets of results match up.
In time zones specified by name, we follow the POSIX convention
(also used by the IANA timezone folk) in which positive offsets are
west of Greenwich. The great thing about standards is there are
so many to choose from :-(
> Having read the documentation (section 8.5.3), I can't actually see any
> allowance for this formatted timezone (e.g. +12 or -12).
It's a POSIX timezone specification with an empty zone abbreviation
and no DST part.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, duncan.stokes@eyemagnet.com
Subject: Re: BUG #14082: Unexpected time adjustment for output using "at time zone"
In-Reply-To: <13349.1460414959@sss.pgh.pa.us>
References: <20160410220738.15199.93161@wrigleys.postgresql.org> <13349.1460414959@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