Re: The contents of the pg_timezone_names view bring some surprises - Mailing list pgsql-general

From Tom Lane
Subject Re: The contents of the pg_timezone_names view bring some surprises
Date
Msg-id 3419065.1621432322@sss.pgh.pa.us
Whole thread Raw
In response to Re: The contents of the pg_timezone_names view bring some surprises  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: The contents of the pg_timezone_names view bring some surprises
List pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, May 18, 2021, Bryn Llewellyn <bryn@yugabyte.com> wrote:
>> Am I missing an essential clue to resolving what seems to me to be a
>> paradox? Or am I seeing two kinds of bug?

> You are missing the material in appendix B.4
> https://www.postgresql.org/docs/current/datetime-config-files.html

The short answer is that the reason there are two views is that
there are two sources of truth involved.  pg_timezone_names reflects
the zone names defined in the IANA timezone database, while
pg_timezone_abbrevs reflects the abbreviations defined in our
user-customizable abbreviations table.  It'd be impossible to make
them match exactly, and we don't try exceedingly hard.  In particular,
the IANA list has some zones such as "CET" that don't follow their own
continent/city naming convention.  (AFAIK those are all legacy zones
that they'd get rid of if they weren't concerned with backwards
compatibility.)  If those look like abbreviations, which they mostly
do, then it's confusing.

Where the rubber meets the road is in timestamptz input, and there
we consult the abbreviations table first.  (Not sure if that's
documented, but you can easily prove it by experiment.)

As for the question about "abbreviations" like +09 --- those are
not abbreviations at all, they're just hard-coded numeric UTC
offsets.  So they don't appear in pg_timezone_abbrevs.  IANA
uses those as display offsets in zones where there's not any
widely-used-on-the-ground abbreviation.

            regards, tom lane



pgsql-general by date:

Previous
From: Ron
Date:
Subject: pgbackrest info of encrypted seems broken
Next
From: Adrian Klaver
Date:
Subject: Re: The contents of the pg_timezone_names view bring some surprises