Re: here does postgres take its timezone information from? - Mailing list pgsql-general

From Tom Lane
Subject Re: here does postgres take its timezone information from?
Date
Msg-id 18417.1573003209@sss.pgh.pa.us
Whole thread Raw
In response to Re: here does postgres take its timezone information from?  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: here does postgres take its timezone information from?  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-general
Thomas Munro <thomas.munro@gmail.com> writes:
> On Wed, Nov 6, 2019 at 12:02 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>> On 11/5/19 3:00 PM, Chris Withers wrote:
>>> Hmm. Is there any option to use the system timezone packages?

>> --with-system-tzdata=DIRECTORY

> I hope that most distributions do that*, because otherwise you
> could finish up with lots of out-of-sync copies of the tzdata database
> inside your database, your JVM, your libc, etc etc, and you want a
> single source of truth for that stuff.

Right.  Our recommendation is to use --with-system-tzdata if you're on
a platform where the vendor updates their copy of tzdata regularly.
The fact that we supply a copy of tzdata at all is really just a fallback
for folks on poorly-supported platforms.  (Naming no names here ...)

> Assuming you are using system tzdata, your other question was what you
> need to do after the tzdata files have been updated.  I suspect that
> new PostgreSQL database sessions (processes) will see the new rules,
> but existing sessions may continue to see the old rules if they had
> loaded them already, because we cache them in per-process memory (see
> pg_tzset()).  It would probably be safest to restart the PostgreSQL
> cluster.

Yeah, I think you need a restart typically.  The postmaster process will
not absorb any update to timezone data it's already loaded, and child
processes will mostly inherit that data via fork().  You might be able
to finagle it by hacks like changing postgresql.conf to a different
timezone name that happens to be equivalent, but on the whole a quick
restart after updating the zone data is the best bet.

(Really, if your active zone's rules have changed, you'd be well advised
to just reboot the whole darn box.  Postgres is *very far* from being
the only daemon that is going to give you issues with this.)

> *It looks like FreeBSD's port uses the copy of tzdata from the
> PostgreSQL source tree by default and thus that is what you get if you
> install PostgreSQL with "pkg".  That's not a great default IMHO and
> should be changed.

Ugh.  Who can we poke there?

            regards, tom lane



pgsql-general by date:

Previous
From: Thomas Munro
Date:
Subject: Re: here does postgres take its timezone information from?
Next
From: Thomas Munro
Date:
Subject: Re: here does postgres take its timezone information from?