Re: Add standard collation UNICODE

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Jeff Davis <pgsql@j-davis.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-03-08T07:10:02Z
Lists: pgsql-hackers
On 04.03.23 19:29, Jeff Davis wrote:
> I do like your approach though because, if someone is using a standard
> collation, I think "not built with ICU" (feature not supported) is a
> better error than "collation doesn't exist". It also effectively
> reserves the name "unicode".

By the way, speaking of reserving names, I don't remember the reason for 
this bit in initdb.c:

/*
  * Add SQL-standard names.  We don't want to pin these, so they don't go
  * in pg_collation.h.  But add them before reading system collations, so
  * that they win if libc defines a locale with the same name.
  */

Why don't we want them pinned?

If we add them instead as entries into pg_collation.dat, it seems to 
work for me.

Another question: What is our current thinking on using BCP 47 names? 
The documentation says for example

"""
The first example selects the ICU locale using a “language tag” per BCP 
47. The second example uses the traditional ICU-specific locale syntax. 
The first style is preferred going forward, but it is not supported by 
older ICU versions.
"""

My patch uses 'und' [BCP 47 style], which appears to be in conflict with 
that statement.

But we have had some discussions on how correct that statement is, but I 
don't remember the outcome.




Commits

  1. initdb: Set collversion for standard collation UNICODE

  2. Add standard collation UNICODE