]> granicus.if.org Git - postgresql/commit
Fix edge-case behavior of pg_next_dst_boundary().
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Apr 2012 21:25:12 +0000 (17:25 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Apr 2012 21:26:10 +0000 (17:26 -0400)
commitc62b8eaae11aaa69a2b71bc63f9f78ca72eb412c
treeeaf11c7369bafeb729c6ddcbd51ed1c6490870e4
parentca1e1a8da11d188df738ba67632c0805a00d3f27
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.
src/timezone/localtime.c