docker-library / postgres

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

There is a difference in string comparison between alpine and normal versions #1172

Open GarrisonD opened 7 months ago

GarrisonD commented 7 months ago

Ran into https://github.com/docker-library/postgres/issues/851 using postgres:16.1-alpine

In README.md it's said:

Also of note, Alpine-based variants starting with Postgres 15 support ICU locales. Previous Postgres versions based on alpine do not support locales; see "Character sets and locale" in the musl documentation for more details.

As far as I understand, now it should be possible to build the alpine-based image with the correct en-US.UTF-8 collation and have proper string comparison. Or do I miss anything?

GarrisonD commented 7 months ago

I mean that would be cool to have the same behaviour out of the box for both alpine- and debian-based images.

GarrisonD commented 7 months ago

https://github.com/docker-library/postgres/issues/327

LaurentGoderre commented 6 months ago

Have you tried setting your collation using the env var like this comment here: https://github.com/docker-library/postgres/issues/1004#issuecomment-1280559846

GarrisonD commented 6 months ago

Yes, that helps. But my question is not how to fix it but rather why ENV POSTGRES_INITDB_ARGS "--locale-provider=icu --icu-locale=en-US" isn't part of alpine-based image? Developers use alpine-based images to make the dev setup faster and smaller but they don't know that it comes with the price of different behaviour.