0001-initdb-Set-collversion-for-standard-collation-UNICOD.patch

text/plain

Filename: 0001-initdb-Set-collversion-for-standard-collation-UNICOD.patch
Type: text/plain
Part: 0
Message: Re: Add standard collation UNICODE

Patch

Format: format-patch
Series: patch 0001
Subject: initdb: Set collversion for standard collation UNICODE
File+
src/bin/initdb/initdb.c 7 0
From 91f2aff04f9bf137e4ac6e7df624dde770503bfd Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 8 May 2023 17:45:46 +0200
Subject: [PATCH] initdb: Set collversion for standard collation UNICODE

Discussion: https://www.postgresql.org/message-id/49417853-7bdd-4b23-a4e9-04c7aff33821@manitou-mail.org
---
 src/bin/initdb/initdb.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 2c208ead01..632f6c9c72 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -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,
+	 * except 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");
 }
-- 
2.40.0