-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Collation is wrong in alpine version #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
👍 |
Any updates on this? This case popped out in timescale/timescaledb#448. |
This sounds similar to #273 / #276 (which both still have an unknown root cause). 😞 The next step for determining the root of the problem would be to install PostgreSQL from Alpine's repos and see if that also exhibits the problem (because if it does, that points more strongly at a musl issue rather than a PostgreSQL issue or even a Docker image specific issue). |
Maybe relevant: official musl vs glibc Character sets and locale https://wiki.musl-libc.org/functional-differences-from-glibc.html#Character-sets-and-locale |
We just ran into this also, anyone running the alpine image got the default "C" collation. |
My entire development team spent the last 6 hours debugging why our unit tests were failing on some local installations and not others. It came down to: the unit tests were written against the Alpine image and expected results is a specific order and the non-Alpine image returned results in a different order. I ask that the Docker hub page be updated to reflect this as I doubt that we are the only development team that has run into this. A note that "Alpine" will use "C" collation is almost all cases (at least from our testing) would be sufficient. |
Great idea, I've filed docker-library/docs#1778 👍 |
If you build PostgreSQL with ICU, then you can use ICU Collations instead. Since Alpine v3.16, install icu-data-full to get support for all locales. |
Here's how you can get it working with the new postgres:15-alpine image. |
…ollation settings Without that those tests would fail for alpine docker image (see: docker-library/postgres#327)
…ollation settings Without that those tests would fail for alpine docker image (see: docker-library/postgres#327)
…ollation settings Without that those tests would fail for alpine docker image (see: docker-library/postgres#327)
If you run this test:
First
SELECT
should gives this order:But instead it gives (same result as
COLLATE "C"
):Works fine in Jessie version.
It's probably because current musl library version (1.1.16) does not support LC_COLLATE, so despite settings LANG variable, sorting data will be bytewise (C). LC_COLLATE should be added to musl version 1.1.17.
The text was updated successfully, but these errors were encountered: