BUG #13670: DST discrepancy between age() and subtraction for timestamptz arguments - Mailing list pgsql-bugs

From jpruitt@doozer.com
Subject BUG #13670: DST discrepancy between age() and subtraction for timestamptz arguments
Date
Msg-id 20151008223405.1223.38427@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13670: DST discrepancy between age() and subtraction for timestamptz arguments  (Haribabu Kommi <kommi.haribabu@gmail.com>)
List pgsql-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"

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #13668: Production server Crash
Next
From: oktogen@mail.ru
Date:
Subject: BUG #13671: pg_terminate_backend(pid) does not work