Bug 57795 - Postgres warning after update from 5.0 to 5.2 with postgresql-15
Summary: Postgres warning after update from 5.0 to 5.2 with postgresql-15
Status: CLOSED FIXED
Alias: None
Product: UCS
Classification: Unclassified
Component: PostgreSQL
Version: UCS 5.2
Hardware: Other Linux
: P5 normal
Target Milestone: UCS 5.2-0-errata
Assignee: Marius Meschter
QA Contact: Arvid Requate
URL: https://git.knut.univention.de/univen...
Keywords:
Depends on: 56540
Blocks:
  Show dependency treegraph
 
Reported: 2024-12-04 20:43 CET by Felix Botner
Modified: 2025-04-21 08:16 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Workaround is available
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2024-12-04 20:43:05 CET
If postgresql is installed in version 15 in UCS 5.0 and the system is updated to 5.2, postgres print this warning

$ univention-pkgdb-scan
WARNUNG:  Version von Sortierfolge für Datenbank »pkgdb« stimmt nicht überein
DETAIL:  Die Datenbank wurde mit Sortierfolgenversion 2.28 erzeugt, aber das Betriebssystem hat Version 2.36.
HINT:  Bauen Sie alle Objekte in dieser Datenbank, die die Standardsortierfolge verwenden, neu und führen Sie ALTER DATABASE pkgdb REFRESH COLLATION VERSION aus, oder bauen Sie PostgreSQL mit der richtigen Bibliotheksversion.

In this case it is univention-pkgdb-scan which wants to update some data, but the same warning appears in the keycloak logs, so it doesn't matter which database/service is used.

Seems to be a problem with the combination of postgresql-15 and libc6 (libc6 is updated fro 2.28  to 2.36 during the upgrade)

We guess that all the databases need to be updated in this case:
- https://www.postgresql.org/docs/15/sql-altercollation.html#SQL-ALTERCOLLATION-NOTES
- https://forum.greenbone.net/t/the-database-was-created-using-collation-version-2-35-but-the-operating-system-provides-version-2-36/13562/4

Currently we don't know of any negative impacts of this.
Comment 1 Arvid Requate univentionstaff 2025-01-06 13:05:07 CET
As noted at the gitlab issue, we need to describe the re-indexing steps
required to accommodate for the libc changes in collation.

I guess we can simply extend https://help.univention.com/t/22162
which has been created for Bug #56540.
Comment 2 Jan-Luca Kiok univentionstaff 2025-03-24 13:08:20 CET
Workaround (and possibly also the solution):

Run `su postgres -c 'psql -c "ALTER DATABASE postgres REFRESH COLLATION VERSION;"'`
Comment 3 Arvid Requate univentionstaff 2025-03-24 13:40:52 CET
Nah, that's faking it. You need to re-index first!!

https://www.postgresql.org/docs/15/sql-altercollation.html#SQL-ALTERCOLLATION-NOTES says:

> When this happens, all objects depending on the collation should be rebuilt, for example, using REINDEX. When that is done, the collation version can be refreshed using the command ALTER COLLATION ... REFRESH VERSION. This will update the system catalog to record the current collation version and will make the warning go away. Note that this does not actually check whether all affected objects have been rebuilt correctly.
Comment 4 Marius Meschter univentionstaff 2025-04-10 08:44:15 CEST
univention-updater (17.0.34)
36d51f90086c | Bug #57795: update postgres collation in postup.sh

The postup.sh script for 5.2-0 now checks if univention-postgresql15 is installed, and in case it is, it will iterate over all databases checking if their collation version needs to be refreshed
Comment 5 Arvid Requate univentionstaff 2025-04-11 11:05:49 CEST
Verified:
* Code review
* Test with postgresql-15 installed in 5.0-10 before update to 5.2-0
* Test with no postgresql installed at all

I installed the postup.sh and signed on mirror/ftp/dists/ucs520.
Felix and I did a test-update with data in psql.
Comment 6 Iván.Delgado univentionstaff 2025-04-21 08:16:14 CEST
Moving to close, changes have been released to mirror/ftp