postgres icon indicating copy to clipboard operation
postgres copied to clipboard

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

Open PythonCoderAS opened this issue 1 year ago • 2 comments

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.

PythonCoderAS avatar Feb 08 '24 01:02 PythonCoderAS

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

yosifkit avatar Feb 08 '24 19:02 yosifkit

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.

PythonCoderAS avatar Feb 10 '24 01:02 PythonCoderAS