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@lists.postgresql.org
Subject: pgsql: Tweak our special-case logic for the IANA "Factory" timezone.
Date: Fri, 26 Jul 2019 17:07:37 +0000
Message-ID: <E1hr3gv-0004vP-4R@gemulon.postgresql.org> (raw)

Tweak our special-case logic for the IANA "Factory" timezone.

pg_timezone_names() tries to avoid showing the "Factory" zone in
the view, mainly because that has traditionally had a very long
"abbreviation" such as "Local time zone must be set--see zic manual page",
so that showing it messes up psql's formatting of the whole view.
Since tzdb version 2016g, IANA instead uses the abbreviation "-00",
which is sane enough that there's no reason to discriminate against it.

On the other hand, it emerges that FreeBSD and possibly other packagers
are so wedded to backwards compatibility that they hack the IANA data
to keep the old spelling --- and not just that old spelling, but even
older spellings that IANA used back in the stone age.  This caused the
filter logic to fail to suppress "Factory" at all on such platforms,
though the formatting problem is definitely real in that case.

To solve both problems, get rid of the hard-wired assumption about
exactly what Factory's abbreviation is, and instead reject abbreviations
exceeding 31 characters.  This will allow Factory to appear in the view
if and only if it's using the modern abbreviation.

In passing, simplify the code we add to zic.c to support "zic -P"
to remove its now-obsolete hacks to not print the Factory zone's
abbreviation.  Unlike pg_timezone_names(), there's no reason for
that code to support old/nonstandard timezone data.

Since we generally prefer to keep timezone-related behavior the
same in all branches, and since this is arguably a bug fix,
back-patch to all supported branches.

Discussion: https://postgr.es/m/3961.1564086915@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8ab66081ca496fd74c406e435e20f4264881a02d

Modified Files
--------------
src/backend/utils/adt/datetime.c | 17 ++++++++---------
src/timezone/zic.c               | 22 ++++++++--------------
2 files changed, 16 insertions(+), 23 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1hr3gv-0004vP-4R@gemulon.postgresql.org>
Permalink:  ../E1hr3gv-0004vP-4R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hr3gv-0004vP-4R@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 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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Tweak our special-case logic for the IANA "Factory" timezone.
  In-Reply-To: <E1hr3gv-0004vP-4R@gemulon.postgresql.org>
  References: <E1hr3gv-0004vP-4R@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