diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2023-03-08 16:35:42 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2023-03-08 16:56:37 +0100 |
commit | 30a53b792959b36f07200dae246067b3adbcc0b9 (patch) | |
tree | abaa763d759b931b2202bea85ec4800592b31624 /src/bin/scripts/createdb.c | |
parent | b1534ed99dc35878e1f9300759e4f10893a32d45 (diff) | |
download | postgresql-30a53b792959b36f07200dae246067b3adbcc0b9.tar.gz postgresql-30a53b792959b36f07200dae246067b3adbcc0b9.zip |
Allow tailoring of ICU locales with custom rules
This exposes the ICU facility to add custom collation rules to a
standard collation.
New options are added to CREATE COLLATION, CREATE DATABASE, createdb,
and initdb to set the rules.
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Daniel Verite <daniel@manitou-mail.org>
Discussion: https://www.postgresql.org/message-id/flat/821c71a4-6ef0-d366-9acf-bb8e367f739f@enterprisedb.com
Diffstat (limited to 'src/bin/scripts/createdb.c')
-rw-r--r-- | src/bin/scripts/createdb.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c index 80859dadc4d..b4205c4fa51 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -41,6 +41,7 @@ main(int argc, char *argv[]) {"maintenance-db", required_argument, NULL, 3}, {"locale-provider", required_argument, NULL, 4}, {"icu-locale", required_argument, NULL, 5}, + {"icu-rules", required_argument, NULL, 6}, {NULL, 0, NULL, 0} }; @@ -67,6 +68,7 @@ main(int argc, char *argv[]) char *locale = NULL; char *locale_provider = NULL; char *icu_locale = NULL; + char *icu_rules = NULL; PQExpBufferData sql; @@ -134,6 +136,9 @@ main(int argc, char *argv[]) case 5: icu_locale = pg_strdup(optarg); break; + case 6: + icu_rules = pg_strdup(optarg); + break; default: /* getopt_long already emitted a complaint */ pg_log_error_hint("Try \"%s --help\" for more information.", progname); @@ -231,6 +236,11 @@ main(int argc, char *argv[]) appendPQExpBufferStr(&sql, " ICU_LOCALE "); appendStringLiteralConn(&sql, icu_locale, conn); } + if (icu_rules) + { + appendPQExpBufferStr(&sql, " ICU_RULES "); + appendStringLiteralConn(&sql, icu_rules, conn); + } appendPQExpBufferChar(&sql, ';'); @@ -288,6 +298,7 @@ help(const char *progname) printf(_(" --lc-collate=LOCALE LC_COLLATE setting for the database\n")); printf(_(" --lc-ctype=LOCALE LC_CTYPE setting for the database\n")); printf(_(" --icu-locale=LOCALE ICU locale setting for the database\n")); + printf(_(" --icu-rules=RULES ICU rules setting for the database\n")); printf(_(" --locale-provider={libc|icu}\n" " locale provider for the database's default collation\n")); printf(_(" -O, --owner=OWNER database user to own the new database\n")); |