Skip to content

Commit 563f21c

Browse files
committed
Move definition of standard collations from initdb to pg_collation.dat
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
1 parent 0d15afc commit 563f21c

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/bin/initdb/initdb.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,20 +1695,7 @@ setup_description(FILE *cmdfd)
16951695
static void
16961696
setup_collation(FILE *cmdfd)
16971697
{
1698-
/*
1699-
* Add SQL-standard names. We don't want to pin these, so they don't go
1700-
* in pg_collation.dat. But add them before reading system collations, so
1701-
* that they win if libc defines a locale with the same name.
1702-
*/
1703-
PG_CMD_PRINTF("INSERT INTO pg_collation (oid, collname, collnamespace, collowner, collprovider, collisdeterministic, collencoding, colliculocale)"
1704-
"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",
1705-
BOOTSTRAP_SUPERUSERID, COLLPROVIDER_ICU);
1706-
1707-
PG_CMD_PRINTF("INSERT INTO pg_collation (oid, collname, collnamespace, collowner, collprovider, collisdeterministic, collencoding, collcollate, collctype)"
1708-
"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",
1709-
BOOTSTRAP_SUPERUSERID, COLLPROVIDER_LIBC, PG_UTF8);
1710-
1711-
/* Now import all collations we can find in the operating system */
1698+
/* Import all collations we can find in the operating system */
17121699
PG_CMD_PUTS("SELECT pg_import_system_collations('pg_catalog');\n\n");
17131700
}
17141701

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202303291
60+
#define CATALOG_VERSION_NO 202303292
6161

6262
#endif

src/include/catalog/pg_collation.dat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,12 @@
2323
descr => 'standard POSIX collation',
2424
collname => 'POSIX', collprovider => 'c', collencoding => '-1',
2525
collcollate => 'POSIX', collctype => 'POSIX' },
26+
{ oid => '962', descr => 'sorts by Unicode code point',
27+
collname => 'ucs_basic', collprovider => 'c', collencoding => '6',
28+
collcollate => 'C', collctype => 'C' },
29+
{ oid => '963',
30+
descr => 'sorts using the Unicode Collation Algorithm with default settings',
31+
collname => 'unicode', collprovider => 'i', collencoding => '-1',
32+
colliculocale => 'und' },
2633

2734
]

0 commit comments

Comments
 (0)