Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkQbt-0008NU-KF for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Oct 2015 05:52:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZkQbs-0002Va-9U for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Oct 2015 05:52:52 +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) (envelope-from ) id 1ZkJmG-00013S-Jp for pgsql-bugs@postgresql.org; Thu, 08 Oct 2015 22:35:08 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZkJmC-0000WR-2G for pgsql-bugs@postgresql.org; Thu, 08 Oct 2015 22:35:06 +0000 MIME-Version: 1.0 Subject: BUG #13670: DST discrepancy between age() and subtraction for timestamptz arguments To: pgsql-bugs@postgresql.org From: jpruitt@doozer.com Date: Thu, 08 Oct 2015 22:34:05 +0000 Message-ID: <20151008223405.1223.38427@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.2 (-) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" 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 The following bug has been logged on the website: Bug reference: 13670 Logged by: John Pruitt Email address: jpruitt@doozer.com PostgreSQL version: 9.4.4 Operating system: x86_64-apple-darwin Description: We are seeing a discrepancy between what is returned by the age(timestamptz, timestamptz) function versus using the subtraction operator (timestamptz - timestamptz) on the DST transition days. It appears that the subtraction operator gives the correct answers, while the age function does not. /* short day - 2:00 is skipped - 1 hour is correct */ select '2015-03-08 03:00'::timestamptz - '2015-03-08 01:00'::timestamptz -- 1 hour , age('2015-03-08 03:00'::timestamptz, '2015-03-08 01:00'::timestamptz) -- 2 hours ; /* long day - 1:00 repeats - 3 hours is correct */ select '2014-11-02 02:00'::timestamptz - '2014-11-02 00:00'::timestamptz -- 3 hours , age('2014-11-02 02:00'::timestamptz, '2014-11-02 00:00'::timestamptz) -- 2 hours ; The timezone setting in the database is 'America/Chicago' which is the same setting in the operating system. show timezone; -- 'America/Chicago' version(): version "PostgreSQL 9.4.4 on x86_64-apple-darwin, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00), 64-bit" -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs