public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: Daniel Verite <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Add standard collation UNICODE
Date: Mon, 8 May 2023 17:48:09 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On 27.04.23 13:44, Daniel Verite wrote:
> This collation has an empty pg_collation.collversion column, instead
> of being set to the same value as "und-x-icu" to track its version.
> The original patch implements this as an INSERT in which it would be easy to
> fix I guess, but in current HEAD it comes as an entry in
> include/catalog/pg_collation.dat:
>
> { oid => '963',
> descr => 'sorts using the Unicode Collation Algorithm with default
> settings',
> collname => 'unicode', collprovider => 'i', collencoding => '-1',
> colliculocale => 'und' },
>
> Should it be converted back into an INSERT or better left
> in this file and collversion being updated afterwards?
How about we do it with an UPDATE command. We already do this for
pg_database in a similar way. See attached patch.
From 91f2aff04f9bf137e4ac6e7df624dde770503bfd Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
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/[email protected]
---
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
Attachments:
[text/plain] 0001-initdb-Set-collversion-for-standard-collation-UNICOD.patch (1.1K, ../[email protected]/2-0001-initdb-Set-collversion-for-standard-collation-UNICOD.patch)
download | inline diff:
From 91f2aff04f9bf137e4ac6e7df624dde770503bfd Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
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/[email protected]
---
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
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Add standard collation UNICODE
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox