docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.16k stars 1.13k forks source link

Missing Europe/Kyiv timezone on 14.6 #1046

Closed jacopofar closed 9 months ago

jacopofar commented 1 year ago

Hello, looking at the release notes of Postgres 14.6 it's mentioned that Europe/Kyiv should be available as a timezone name. If I try to use it in a freshly pulled image however it does not seem to work.

I start it with this command, which also triggers the pull

docker run -d --rm -e POSTGRES_PASSWORD=mysecretpassword postgres:14.6

then I get a shell with docker exec -it 04cb9ab5237f (where 04cb9ab5237f is the id of the container just started) and run psql -U postgres

I checked with:

root@04cb9ab5237f:/# psql -U postgres
psql (14.6 (Debian 14.6-1.pgdg110+1))
Type "help" for help.

postgres=# select current_timestamp at time zone 'Europe/Kyiv';
ERROR:  time zone "Europe/Kyiv" not recognized
postgres=# select current_timestamp at time zone 'Europe/Rome';
          timezone          
----------------------------
 2023-02-10 13:02:02.033276
(1 row)

postgres=# select current_timestamp at time zone 'Europe/Kiev';
          timezone          
----------------------------
 2023-02-10 14:02:09.957155
(1 row)
postgres=# select version();
                                                       version                                                 

-------------------------------------------------------------------------------------------------------------------
----------
 PostgreSQL 14.6 (Debian 14.6-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 2021011
0, 64-bit
(1 row)

am I missing something here? Is it possible that the docker build differs regarding timezones? I have the very same problem on the image for postgres 15.1

tianon commented 1 year ago

That's weird -- I thought the timezone list for PostgreSQL came from tzdata in the distro, and looking at https://packages.debian.org/file:Europe/Kyiv, I don't see it until I switch to tzdata from the yet-unreleased Bookworm release, so I think that might be related? :thinking:

jacopofar commented 1 year ago

Yes, I suspect this could be the reason.

Bullseye has tzdata 2021a-1+deb11u8 https://packages.debian.org/bullseye/tzdata While Sid and Bookworm have 2022g-4/5 and this specific change was introduced in 2022g-1.

This same problem happens also with Mexico/Ciudad_Juarez and a few others, I know that Debian tends to be on older version of packages but I'd expect tzdata to be an exception.

Anyways, looking at this conversation it seems there's an option to use builtin timezone data rather than the one from the system, could it be an option? That version is up to date to 2022g so it would solve the issue

yosifkit commented 1 year ago

it seems there's an option to use builtin timezone data rather than the one from the system, could it be an option?

Unfortunately, we just install the deb packages managed by the PostgreSQL community, so we can't change how they are built:

https://github.com/docker-library/postgres/blob/156d0659d047578f06aa8785cf12d547c6a5ccfd/Dockerfile-debian.template#L92

The Alpine based images do build from source and set the with-system-tzdata flag:

https://github.com/docker-library/postgres/blob/156d0659d047578f06aa8785cf12d547c6a5ccfd/Dockerfile-alpine.template#L98

jacopofar commented 1 year ago

Pity, thank for the answer.

So the build has to wait for the distros to update their data. I don't really know where and how to report this to Debian, but think this ticket can be closed.

If someone comes here with the same problem, I can add I had it with Amazon RDS version, could not find details on the tzdata but updating from Postgres 14.5 to 14.6 did fix it, so it seems they use the tzdata incorporated in Postgres.

jacopofar commented 9 months ago

Wanted to add that now Debian has a new release with updated tzdata (although presumably the problem will happen again with future tzdata updates if Debian doesn't update it), this works on the Docker images for Postgres 14.7 and 14.8, but not 14.6.

Probably this can be closed.