Postgres in alpine has collation warning if database was created in another OS.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the warning with the supplied postgres:15.8-bookworm and postgres:15.8-alpine3.20 Docker commands. Read CheckMyDatabase in src/backend/utils/init/postinit.c and trace get_collation_actual_version, then establish why actual_versionstr is NULL and whether the cross-OS behavior is expected.
Written by the indexing model from the issue text.
Description
Postgres shows warning WARNING: database "postgres" has no actual collation version, but a version was recorded if database was created in another OS.
Steps for reproduce:
- Execute postgres in debian image:
docker run --rm -e POSTGRES_PASSWORD=password -e POSTGRES_DB=app -v $(pwd)/data:/var/lib/postgresql/data postgres:15.8-bookworm - Stop this
- Execute postgres in alpine image:
docker run --rm --name postgres -v $(pwd)/data:/var/lib/postgresql/data postgres:15.8-alpine3.20 - Run psql:
$ docker exec -ti --user postgres postgres psql
WARNING: database "postgres" has no actual collation version, but a version was recorded
psql (15.8)
Type "help" for help.
postgres=# \c app
WARNING: database "app" has no actual collation version, but a version was recorded
You are now connected to database "app" as user "postgres".
app=#
Research:
I found that a warning occurs in the CheckMyDatabase function when comparing the collate version in the database and the current one in this row.
...
if (!isnull)
{
char *actual_versionstr;
char *collversionstr;
collversionstr = TextDatumGetCString(datum);
actual_versionstr = get_collation_actual_version(dbform->datlocprovider, dbform->datlocprovider == COLLPROVIDER_ICU ? iculocale : collate);
if (!actual_versionstr)
/* should not happen */
elog(WARNING,
"database \"%s\" has no actual collation version, but a version was recorded",
name);
else if (strcmp(actual_versionstr, collversionstr) != 0)
...
After calling get_collation_actual_version, the actual_version_str variable is NULL, because the get_collation_actual_version function after the preprocessor looks like:
char *
get_collation_actual_version(char collprovider, const char *collcollate)
{
char *collversion = NULL;
if (collprovider == COLLPROVIDER_LIBC &&
pg_strcasecmp("C", collcollate) != 0 &&
pg_strncasecmp("C.", collcollate, 2) != 0 &&
pg_strcasecmp("POSIX", collcollate) != 0)
{
}
return collversion;
}
And it always returns NULL
- Dominant language
- Shell
- Stars
- 2.5k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docker-library/postgres
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
docker-library/postgres#1420 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
docker-library/postgres#1419 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
docker-library/postgres#1389 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
docker-library/postgres#1356 · 5 comments · 7 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
docker-library/postgres#1355 · 10 comments · 11 reactions ·
All issues in docker-library/postgres
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
obra/superpowers#2445 ·
Maintainers usually reply within 5 days
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oSoWoSo/vOid_Community_repOsitory#240 · 1 comment ·
Maintainers usually reply within 1 day
-
ai-inspected
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
[Bug]: atuin doctor reports "Hub (authenticated)" while the client syncs with a self-hosted serverOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day