pgsql: Fix assorted breakage in to_char()'s OF format option.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix assorted breakage in to_char()'s OF format option.
Date: 2016-03-17 19:50:51
Message-ID: E1agdwZ-00015v-7q@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assorted breakage in to_char()'s OF format option.

In HEAD, fix incorrect field width for hours part of OF when tm_gmtoff is
negative. This was introduced by commit 2d87eedc1d4468d3 as a result of
falsely applying a pattern that's correct when + signs are omitted, which
is not the case for OF.

In 9.4, fix missing abs() call that allowed a sign to be attached to the
minutes part of OF. This was fixed in 9.5 by 9b43d73b3f9bef27, but for
inscrutable reasons not back-patched.

In all three versions, ensure that the sign of tm_gmtoff is correctly
reported even when the GMT offset is less than 1 hour.

Add regression tests, which evidently we desperately need here.

Thomas Munro and Tom Lane, per report from David Fetter

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/utils/adt/formatting.c | 10 ++++--
src/test/regress/expected/timestamptz.out | 51 +++++++++++++++++++++++++++++++
src/test/regress/sql/timestamptz.sql | 17 +++++++++++
3 files changed, 75 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2016-03-17 20:11:00 pgsql: Improve memory management for external sorts.
Previous Message Tom Lane 2016-03-17 18:02:10 Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()