Re: Add standard collation UNICODE

Daniel Verite <daniel@manitou-mail.org>

From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Peter Eisentraut" <peter.eisentraut@enterprisedb.com>
Cc: "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2023-04-27T11:44:55Z
Lists: pgsql-hackers
	Peter Eisentraut wrote:

>      COLLATE UNICODE
> 
> instead of
> 
>      COLLATE "und-x-icu"
> 
> or whatever it is, is pretty useful.
> 
> So, attached is a small patch to add this.

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.


postgres=# select * from pg_collation  where collname='unicode' \gx
-[ RECORD 1 ]-------+--------
oid		    | 963
collname	    | unicode
collnamespace	    | 11
collowner	    | 10
collprovider	    | i
collisdeterministic | t
collencoding	    | -1
collcollate	    | 
collctype	    | 
colliculocale	    | und
collicurules	    | 
collversion	    | 

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?


Best regards,
-- 
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite



Commits

  1. initdb: Set collversion for standard collation UNICODE

  2. Add standard collation UNICODE