'database "pkgdb" has a collation version mismatch' while upgrading to 5.2

I’m hitting the same issue again.

While installing 5.1 the update fails at:

Processing triggers for univention-config (16.0.6) ...
dpkg-query: no packages found matching ldapacl_66univention-appcenter_app.acl
dpkg-query: no packages found matching messages_en.properties
dpkg-query: no packages found matching ldapacl_62univention-monitoring.acl
dpkg-query: no packages found matching ldapacl_58openid-connect-provider.ldapacl
dpkg-query: no packages found matching univention-keycloak
dpkg-query: no packages found matching ldapacl_61guardian.acl
dpkg-query: no packages found matching ldapacl_62univention-portal.acl
dpkg-query: no packages found matching ldapacl_59univention-radius.acl
dpkg-query: no packages found matching messages_de.properties
dpkg-query: no packages found matching ldapacl_67keycloak.acl
dpkg-query: no packages found matching ldapacl_66univention-radius.acl
dpkg-query: no packages found matching 50-keycloak
Errors were encountered while processing:
 univention-dhcp
WARNING:  database "pkgdb" has a collation version mismatch
DETAIL:  The database was created using collation version 2.28, but the operating system provides version 2.31.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE pkgdb REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

Reading package lists... 0%
Reading package lists... 0%
...
Reading package lists... Done
Building dependency tree... 0%
...
Building dependency tree... Done
Reading state information... 0% 
Reading state information... 0%
Reading state information... Done
E: Sub-process /usr/bin/dpkg returned an error code (1)
Error: Failed to execute "apt-get -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-overwrite -o DPkg::Options::=--force-overwrite-dir --trivial-only=no --assume-yes --quiet=1 dist-upgrade"
exitcode of univention-updater: 1

What does this mean? Is there a way to update the "pkgdb" and if so, how?

Addendum:
After restoring UCS 5.0-10

  1. I found this Delete unwanted entries from admin diary which explain how to access psql.
  2. Used this to “refresh collation version”

But neither change anything
image