Re: Psycopg3 fails to resolve 'timezone localtime' on MacOS - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Psycopg3 fails to resolve 'timezone localtime' on MacOS
Date
Msg-id CA+bJJbz0t6a+L3jh_WSW5q6DBVVD-UE+SkQrNL4bHQdiv+9uGQ@mail.gmail.com
Whole thread Raw
In response to Psycopg3 fails to resolve 'timezone localtime' on MacOS  (Jerry Sievers <gsievers19@comcast.net>)
List pgsql-general
Jerry:

On Fri, 6 May 2022 at 03:04, Jerry Sievers <gsievers19@comcast.net> wrote:
> Has anyone run into This?
> Psycopg3 fails to resolve timezone localtime on MacOS (Catalina).
>
> It falls back to UTC regardless of whether running with/without the
> tzdata package which I did try.
>
> There is a /etc/localtime symlink on this box pointed at the correct
> file in the tz data directory, which apparently doesn't get used.
>
> Adding a temporary symlink directly into the tz data directory got
> things working but I'm skeptical of such a hack.

I'm not using Mac, but Linux, and not python, but I think you have
some concepts mixed.

In Linux, and it seems Mac is pretty similar, to define a timezone you
put something readable in tzfile(5) format  ( i.e. a file or a symlink
to a file as you did ) in /usr/share/zoneinfo ( this is the "tzdata
directory" ).

Then, to set the system default timezone you copy ( or link ) a tzfile
in /etc/localtime. Note this DOES NOT define a named timezone that you
can use. And there is NOT a timezone named "localtime".

Normaly you use a symbolic link from etc/localtime to the timezone
directory, which has the nice side effect of letting you read the link
to know the name, but it does not have to be. I think this is leading
you into thinking "localtime" is a valid name, which is not, or was
not until you defined it but creating the name by adding the temporary
symlink.

If you want to have a zone named "localtime" pointing to the default
zone, adding a symlink in the tzdata dir named "localtime" ( directory
entries is what define the names ) pointint to /etc/localtime will do
it, but I would not recommend it.

Your errors are pretty extrange. Are you exporting TZ or whichever env
var MacOs uses or a similar thing set to "localtime" in any of the
relevant environments ( i.e., the server or client process ), or
setting the server timezone to "localtime"?

Because normally when you want "localtime" what you want is the
process system default timezone, so you do not set anything in the
process ($TZ) included, and let the library fallback to the system
default timezone ( unnamed ). This seems like some configuration
problem.

Framcisco Olarte.



pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Order of rows in statement triggers NEW/OLD tables
Next
From: Zb B
Date:
Subject: Re: Replication with Patroni not working after killing secondary and starting again