docker-library / postgres

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

Alpine version does not have same behavior for case-sensitive string comparisons in certain cases #1193

Open PythonCoderAS opened 5 months ago

PythonCoderAS commented 5 months ago

Ran into a weird problem (Running docker desktop on M1 Mac):

When I do some exact string matches (SELECT * FROM table where name='Sample Name'), for some strings, it will return 0 results even though I can confirm there is a record with that string (by matching with the ID pkey). However, this does work if I do SELECT * FROM table where name LIKE '%Sample Name'. I've confirmed through looking at the raw bytes that there are no characters in front of the name.

However, if I change the version to the non-alpine version, SELECT * FROM table where name='Sample Name' starts returning the row as expected. I'm not sure why this is the case at all.

yosifkit commented 5 months ago

This seems similar to https://github.com/docker-library/postgres/issues/273 / https://github.com/docker-library/postgres/issues/276. And maybe also https://github.com/docker-library/postgres/issues/327 and https://github.com/docker-library/postgres/issues/1172

PythonCoderAS commented 5 months ago

I fixed this for now by taking a database dump (while on the non-alpine version), deleting the volume, re-creating the volume, and importing the dump again into postgres while on alpine.