initdb: Set collversion for standard collation UNICODE
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 12 May 2023 07:45:50 +0000 (09:45 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 12 May 2023 08:03:05 +0000 (10:03 +0200)
Since the behavior of the UNICODE collation can change with new
ICU/Unicode versions, we need to apply the versioning mechanism to it.
We do this with an UPDATE command in initdb; this is similar to how we
put the collation version into pg_database already.

Reported-by: Daniel Verite <daniel@manitou-mail.org>
Discussion: https://www.postgresql.org/message-id/49417853-7bdd-4b23-a4e9-04c7aff33821@manitou-mail.org

src/bin/initdb/initdb.c
src/include/catalog/catversion.h

index 2c208ead019b52ee456ec516c7344898c8e7a452..e03d498b1e073e4447b7108b4ee28c5b526ab8df 100644 (file)
@@ -1695,6 +1695,13 @@ setup_description(FILE *cmdfd)
 static void
 setup_collation(FILE *cmdfd)
 {
+   /*
+    * Set the collation version for collations defined in pg_collation.dat,
+    * but not the ones where we know that the collation behavior will never
+    * change.
+    */
+   PG_CMD_PUTS("UPDATE pg_collation SET collversion = pg_collation_actual_version(oid) WHERE collname = 'unicode';\n\n");
+
    /* Import all collations we can find in the operating system */
    PG_CMD_PUTS("SELECT pg_import_system_collations('pg_catalog');\n\n");
 }
index a091f2ca264855b3067c817872a12e6c3220b4df..d10cc28b0c1c5e703c096250814bd9c58776f4f7 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202305041
+#define CATALOG_VERSION_NO 202305121
 
 #endif