pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jpruitt@doozer.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13670: DST discrepancy between age() and subtraction for timestamptz arguments
Date: Thu, 08 Oct 2015 22:34:05 +0000
Message-ID: <20151008223405.1223.38427@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (9+ messages)  latest in thread

Message-ID: <20151008223405.1223.38427@wrigleys.postgresql.org>
Permalink:  ../20151008223405.1223.38427@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20151008223405.1223.38427@wrigleys.postgresql.org

 · 

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 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: jpruitt@doozer.com
  Subject: Re: BUG #13670: DST discrepancy between age() and subtraction for timestamptz arguments
  In-Reply-To: <20151008223405.1223.38427@wrigleys.postgresql.org>
  References: <20151008223405.1223.38427@wrigleys.postgresql.org>

* 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