Re: Timezone: resolve $TZDIR in runtime

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: zarkonesmall(at)gmail(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Timezone: resolve $TZDIR in runtime
Date: 2024-10-21 14:37:47
Message-ID: 1554256.1729521467@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Anatolii Smolianinov <zarkonesmall(at)gmail(dot)com> writes:
> I was recently working with a project which embeds postgres into
> application. It uses binaries built for Debian, and configured to look for
> timezones in Debian's timezone folder /usr/share/zoneinfo/, which wasn't
> present on my system.

Why are you trying to use binaries built for Debian on some other
platform? Seems like there'd be more problems than just timezones.

> I was thinking if it's possible to redefine it in runtime, and found that
> it is not possible: postgres support either compilation flag
> --with-system-tzdata or built-in tz file -- timezone/data/tzdata.zi. From
> the other hand, looking at src/timezone/pgtz.c#L54, it seems that timezone
> dir resolve happens in runtime, which means, it is possible to use $TZDIR
> environment variable or configuration option to achieve this without
> recompilation.

I'm pretty down on this idea because it adds complexity, ie ways to
break things. If you want a more self-contained installation, you
could build it without specifying --with-system-tzdata.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anatolii Smolianinov 2024-10-21 15:03:14 Re: Timezone: resolve $TZDIR in runtime
Previous Message David G. Johnston 2024-10-21 12:56:46 Re: PostgreSQL Database Community Edition -- Please provide list of the supported hypervisors