Thread: pgsql: Change collate and ctype fields to type text

pgsql: Change collate and ctype fields to type text

From
Peter Eisentraut
Date:
Change collate and ctype fields to type text

This changes the data type of the catalog fields datcollate, datctype,
collcollate, and collctype from name to text.  There wasn't ever a
really good reason for them to be of type name; presumably this was
just carried over from when they were fixed-size fields in pg_control,
first into the corresponding pg_database fields, and then to
pg_collation.  The values are not identifiers or object names, and we
don't ever look them up that way.

Changing to type text saves space in the typical case, since locale
names are typically only a few bytes long.  But it is also possible
that an ICU locale name with several customization options appended
could be longer than 63 bytes, so this also enables that case, which
was previously probably broken.

Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/5e756dd6-0e91-d778-96fd-b1bcb06c161a@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/54637508f87bd5f07fb9406bac6b08240283be3b

Modified Files
--------------
doc/src/sgml/catalogs.sgml           | 40 +++++++++++++++++------------------
src/backend/catalog/pg_collation.c   | 10 +++------
src/backend/commands/collationcmds.c | 41 ++++++++++++++++++++++++------------
src/backend/commands/dbcommands.c    | 21 ++++++++++++------
src/backend/utils/adt/pg_locale.c    | 29 ++++++++++++++++---------
src/backend/utils/init/postinit.c    | 11 ++++++++--
src/include/catalog/catversion.h     |  2 +-
src/include/catalog/pg_collation.h   |  4 ++--
src/include/catalog/pg_database.h    | 12 +++++------
src/include/utils/pg_locale.h        |  2 ++
10 files changed, 105 insertions(+), 67 deletions(-)