pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix edge-case behavior of pg_next_dst_boundary().
Date: Wed, 25 Apr 2012 21:26:25 +0000
Message-ID: <E1SN9jF-0005qO-31@gemulon.postgresql.org> (raw)

Fix edge-case behavior of pg_next_dst_boundary().

Due to rather sloppy thinking (on my part, I'm afraid) about the
appropriate behavior for boundary conditions, pg_next_dst_boundary() gave
undefined, platform-dependent results when the input time is exactly the
last recorded DST transition time for the specified time zone, as a result
of fetching values one past the end of its data arrays.

Change its specification to be that it always finds the next DST boundary
*after* the input time, and adjust code to match that.  The sole existing
caller, DetermineTimeZoneOffset, doesn't actually care about this
distinction, since it always uses a probe time earlier than the instant
that it does care about.  So it seemed best to me to change the API to make
the result=1 and result=0 cases more consistent, specifically to ensure
that the "before" outputs always describe the state at the given time,
rather than hacking the code to obey the previous API comment exactly.

Per bug #6605 from Sergey Burladyan.  Back-patch to all supported versions.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b0f24b5626727f81ecd7024ed5cefbaa336c8100

Modified Files
--------------
src/timezone/localtime.c |   23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)



view thread (5+ messages)

Message-ID: <E1SN9jF-0005qO-31@gemulon.postgresql.org>
Permalink:  ../E1SN9jF-0005qO-31@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1SN9jF-0005qO-31@gemulon.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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix edge-case behavior of pg_next_dst_boundary().
  In-Reply-To: <E1SN9jF-0005qO-31@gemulon.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