database "postgres" has no actual collation version, but a version was recordedGeneral Discussion #31446
SeeYouInTheNextWorld
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
Content
The issue of cross-architecture migration of the PostgreSQL (PG) database: Before migration, the system was Ubuntu 24.04 (compiled and installed), and after migration, the system was an official Docker container (running Alpine). This led to differences in the C libraries (compatibility flaws between the musl C library and ICU), resulting in abnormal JDBC connections. Specific troubleshooting steps are as follows:
Warning: WARNING: database "dify" has no actual collation version, but a version was recorded
Query within the database:
SELECT
datname,
pg_database_collation_actual_version(oid) AS current_version,
datcollversion AS recorded_version
FROM pg_database
WHERE datname NOT IN ('template0','template1');
datname | current_version | recorded_version
-------------+-----------------+------------------
postgres | | 2.39
dify | | 2.39
dify_plugin | | 2.39
(3 rows)
Repair suggestion: It is hoped that the official team can reconstruct an image that supports glibc, or forcibly enable ICU support and recompile it.
C library differences: Alpine Linux uses musl as a replacement for glibc, causing the pg_database_collation_actual_version function in PostgreSQL to return a null value in the musl environment due to incomplete ICU support. This is a known compatibility issue with the integration of musl and PostgreSQL ICU (refer to the official description on Docker Hub).
PG库跨架构迁移问题,迁移之前为 ubuntu24.04 (编译安装),迁移后系统为官方docker容器(系统为Alpine),导致出现 C 库差异(musl C库与ICU兼容性缺陷),从而导致 jdbc 连接异常,具体排查:
警告: WARNING: database "dify" has no actual collation version, but a version was recorded
数据库内查询:
SELECT
datname,
pg_database_collation_actual_version(oid) AS current_version,
datcollversion AS recorded_version
FROM pg_database
WHERE datname NOT IN ('template0','template1');
datname | current_version | recorded_version
-------------+-----------------+------------------
postgres | | 2.39
dify | | 2.39
dify_plugin | | 2.39
(3 rows)
修复建议:希望官方重构一个支持 glibc 镜像,或者强制启用 强制启用ICU支持且重新编译
C库差异:Alpine Linux使用musl替代glibc,导致PostgreSQL的pg_database_collation_actual_version函数在musl环境下因ICU支持不完整而返回空值。这是已知的musl与PostgreSQL ICU集成的兼容性问题(参考Docker Hub官方说明)。
Beta Was this translation helpful? Give feedback.
All reactions