git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0d15afc)
Move definition of standard collations from initdb to pg_collation.dat
2023年3月29日 07:45:21 +0000 (09:45 +0200)
2023年3月29日 07:45:21 +0000 (09:45 +0200)
The standard collations "ucs_basic" and "unicode" were defined in
initdb, even though pg_collation.dat seems like the correct place for
them. It seems this was just forgotten during various reorganizations
of initdb and pg_collation.dat/.h over time.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/08b58ecd-0d50-9395-ed51-dc8294e3fd2b%40enterprisedb.com


diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index d5ac25904da4fbe286be7dcac6a140f6743092a3..208ddc9b302f7a4c973fa26ce15bf973df754dce 100644 (file)
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1695,20 +1695,7 @@ setup_description(FILE *cmdfd)
static void
setup_collation(FILE *cmdfd)
{
- /*
- * Add SQL-standard names. We don't want to pin these, so they don't go
- * in pg_collation.dat. But add them before reading system collations, so
- * that they win if libc defines a locale with the same name.
- */
- PG_CMD_PRINTF("INSERT INTO pg_collation (oid, collname, collnamespace, collowner, collprovider, collisdeterministic, collencoding, colliculocale)"
- "VALUES (pg_nextoid('pg_catalog.pg_collation', 'oid', 'pg_catalog.pg_collation_oid_index'), 'unicode', 'pg_catalog'::regnamespace, %u, '%c', true, -1, 'und');\n\n",
- BOOTSTRAP_SUPERUSERID, COLLPROVIDER_ICU);
-
- PG_CMD_PRINTF("INSERT INTO pg_collation (oid, collname, collnamespace, collowner, collprovider, collisdeterministic, collencoding, collcollate, collctype)"
- "VALUES (pg_nextoid('pg_catalog.pg_collation', 'oid', 'pg_catalog.pg_collation_oid_index'), 'ucs_basic', 'pg_catalog'::regnamespace, %u, '%c', true, %d, 'C', 'C');\n\n",
- BOOTSTRAP_SUPERUSERID, COLLPROVIDER_LIBC, PG_UTF8);
-
- /* Now import all collations we can find in the operating system */
+ /* Import all collations we can find in the operating system */
PG_CMD_PUTS("SELECT pg_import_system_collations('pg_catalog');\n\n");
}
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index db590b6bf076169870a7149b8e40e2ba93a04436..229b0bd54eaea395022fc8c1f72e12f555d25f33 100644 (file)
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202303291
+#define CATALOG_VERSION_NO 202303292
#endif
diff --git a/src/include/catalog/pg_collation.dat b/src/include/catalog/pg_collation.dat
index f4bda1c7697f1079627be5a1a15d94ddb59e5b32..b6a69d1d420413aaa1664354580f425c709cb79c 100644 (file)
--- a/src/include/catalog/pg_collation.dat
+++ b/src/include/catalog/pg_collation.dat
@@ -23,5 +23,12 @@
descr => 'standard POSIX collation',
collname => 'POSIX', collprovider => 'c', collencoding => '-1',
collcollate => 'POSIX', collctype => 'POSIX' },
+{ oid => '962', descr => 'sorts by Unicode code point',
+ collname => 'ucs_basic', collprovider => 'c', collencoding => '6',
+ collcollate => 'C', collctype => 'C' },
+{ oid => '963',
+ descr => 'sorts using the Unicode Collation Algorithm with default settings',
+ collname => 'unicode', collprovider => 'i', collencoding => '-1',
+ colliculocale => 'und' },
]
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /