Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t2twW-008Lnc-By for pgsql-general@arkaria.postgresql.org; Mon, 21 Oct 2024 15:03:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t2twS-008L6y-TQ for pgsql-general@arkaria.postgresql.org; Mon, 21 Oct 2024 15:03:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t2twS-008L6q-AU for pgsql-general@lists.postgresql.org; Mon, 21 Oct 2024 15:03:32 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t2twP-0021Wj-Qw for pgsql-general@lists.postgresql.org; Mon, 21 Oct 2024 15:03:31 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-539fbbadf83so5855219e87.0 for ; Mon, 21 Oct 2024 08:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729523007; x=1730127807; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=X0Q55gOcpSCTDWsuKpf0FX18FdRMN083mhmz1wQL+mQ=; b=IPExY0rXWDRArNQ6yItpBaeUZxBKKr+faD0YiHsCC/RTaFqYIe/S4Oo8qJ29aCxUmb WUcyDweLNUDdkZM7rkcxcp41d7HdVDeYV9y+v1/VPiAur4iswAdeR5IVCJvM1woqqw0A mqBGMtbuZOv0U1YooR1/ntUSSJ9IWlgzmXkC9dAGdGrtqZhy2KNHEt3tW/za8V+hwEXH hHX0YTuzxOqfGH7/OsB3msEkSniaQprNQpxDvFNy3IlFPP2PXrWVmVEd68Vhm2kvGDBD hRc9ZZey0Mu54GkWLzy8DCYM6gcZyfZKgSpeHIOyvgCH6bj4F8ThNbrHFkxUYS2ylj/b MA7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729523007; x=1730127807; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X0Q55gOcpSCTDWsuKpf0FX18FdRMN083mhmz1wQL+mQ=; b=CZTfkGeuyxHe8WpPVyoidcsb/RZPsp1mfpTiwcS5NMnTRMybxXj28NeZc0zNNs6tFM f/bRkFHsuAao6YLELeXAsPS7ZHzKHh4ema9EqIFS65s8aEoXQOpLeXZ0hGjkpm4zAgDq U+9Q2A73edRTKZ0RRGMOLfiRoOPM2uUKH+Dglc60MRwdj9vU+Re/6NpQGBn0yIKKAEQp igcDLO5BkyCsvI09ZPpO+6bz4wq7bW9Yx6M/z+2dRKqmLJJHNkQZSDI+xoltX8yUgz9X skLBshdu2RrUKBB8xpCdhAGTweDrQYet5jCa+giN3RTZpNhIlfZ7qT8fm5CHA9pJG+zn 60Jw== X-Gm-Message-State: AOJu0YyO/rO0knGBYdHES9MzxW6Ue/x0QnjnK82jMwaYf4ZuHOGWq+Mb JQiTUNX3traKTsMBMH3eDd9VuqP1/I7EJ+Dr7JTNiDXnu3P43Warq2QRJQGdpF3dSifcWwPnh7c MooMZ20CeANQaK+OFXWZ2I1CCrVw= X-Google-Smtp-Source: AGHT+IFcQbzkjpRnf2v9m9itiNum+udvSIAo6Xw95EPeBynKgRWObvrrZWv/pEfSPiIu1qSdVLHdzddq+xNDnMYy9pE= X-Received: by 2002:a05:6512:3a82:b0:539:e023:8fce with SMTP id 2adb3069b0e04-53a1543ed0emr5415339e87.12.1729523005736; Mon, 21 Oct 2024 08:03:25 -0700 (PDT) MIME-Version: 1.0 References: <1554256.1729521467@sss.pgh.pa.us> In-Reply-To: <1554256.1729521467@sss.pgh.pa.us> Reply-To: zarkonesmall@gmail.com From: Anatolii Smolianinov Date: Mon, 21 Oct 2024 17:03:14 +0200 Message-ID: Subject: Re: Timezone: resolve $TZDIR in runtime To: Tom Lane Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000006350d80624fdf4e7" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006350d80624fdf4e7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Tom, thanks for your reply! I understand your point, and also, the idea of embedding postgresql -- it might be just not what postgresql is built for. I was just thinking that respecting the standard TZDIR approach would add more flexibility. If you have 5 linux distros and everyone has a different tzdata location, it doesn't make much sense to rebuild binaries for each of these distros. Which means, compile time config is actually the part which adds complexity -- at least for packaging. There is no point in having $TZDIR if it's not respected by software. Also, it feels that setting the filesystem path in compile time just doesn't make much sense -- it should be a part of runtime configuration. In my case though, it doesn't block me or anything, -- as you've mentioned, I can just rebuild without this flag. I was just thinking that supporting the standard way of timezone configuration would improve the experience of using postgresql in general and make it more predictive. Maybe it's not true though due to legacy reasons though -- old users just wouldn't expect $TZDIR to alter the configuration. On Mon, Oct 21, 2024 at 4:37=E2=80=AFPM Tom Lane wrote: > Anatolii Smolianinov 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 th= at > > 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 $TZD= IR > > 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 > --0000000000006350d80624fdf4e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Tom, thanks for your reply!

I understand your point, and also, the idea of embedding postgresql= -- it might be just not what postgresql is built for. I was just thinking = that respecting the standard TZDIR approach would add more flexibility.

If you have 5 linux distros and everyone has a d= ifferent tzdata location, it doesn't make much sense to rebuild binarie= s for each of these distros. Which means, compile time config is actually t= he part which adds complexity -- at least for packaging.=C2=A0
There is no point in having $TZDIR if it's not respected b= y software. Also, it feels that setting the filesystem path in compile time= just doesn't make much sense -- it should be a part of runtime configu= ration.=C2=A0

In my case though, it doesn't bl= ock me or anything, -- as you've mentioned, I can just rebuild without = this flag. I was just thinking that supporting the standard way of timezone= configuration would improve the experience of using postgresql in general = and make it more predictive. Maybe it's not true though due to legacy r= easons though -- old users just wouldn't expect $TZDIR to alter the con= figuration.


<= div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 21, 2024 at 4:37=E2=80=AFP= M Tom Lane <tgl@sss.pgh.pa.us&g= t; wrote:
Anatol= ii Smolianinov <zarkonesmall@gmail.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?=C2=A0 Seems like there'd be more problems than just timezones= .

> I was thinking if it's possible to redefine it in runtime, and fou= nd that
> it is not possible: postgres support either compilation flag
> --with-system-tzdata or built-in tz file --=C2=A0 timezone/data/tzdata= .zi. From
> the other hand, looking at src/timezone/pgtz.c#L54, it seems that time= zone
> dir resolve happens in runtime, which means, it is possible to use $TZ= DIR
> 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.=C2=A0 If you want a more self-contained installation, you
could build it without specifying --with-system-tzdata.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--0000000000006350d80624fdf4e7--