Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apkep-0005ZB-VH for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Apr 2016 22:50:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1apkep-0002GM-Hv for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Apr 2016 22:50:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apkeC-0001VH-Kx for pgsql-bugs@postgresql.org; Mon, 11 Apr 2016 22:49:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apke4-0000ae-T6 for pgsql-bugs@postgresql.org; Mon, 11 Apr 2016 22:49:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u3BMnJIO013350; Mon, 11 Apr 2016 18:49:20 -0400 From: Tom Lane To: duncan.stokes@eyemagnet.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14082: Unexpected time adjustment for output using "at time zone" In-reply-to: <20160410220738.15199.93161@wrigleys.postgresql.org> References: <20160410220738.15199.93161@wrigleys.postgresql.org> Comments: In-reply-to duncan.stokes@eyemagnet.com message dated "Sun, 10 Apr 2016 22:07:38 -0000" Date: Mon, 11 Apr 2016 18:49:19 -0400 Message-ID: <13349.1460414959@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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