aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/createdb.c
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2023-06-16 10:27:32 -0700
committerJeff Davis <jdavis@postgresql.org>2023-06-16 10:27:32 -0700
commita14e75eb0b6a73821e0d66c0d407372ec8376105 (patch)
treeb0fd40e450cdb4f498f911b54a195dcd3ebd1a58 /src/bin/scripts/createdb.c
parentc0d951262c80f42b3bfe037f940e103a24da84f4 (diff)
downloadpostgresql-a14e75eb0b6a73821e0d66c0d407372ec8376105.tar.gz
postgresql-a14e75eb0b6a73821e0d66c0d407372ec8376105.zip
CREATE DATABASE: make LOCALE apply to all collation providers.
For CREATE DATABASE, make LOCALE parameter apply regardless of the provider used. Also affects initdb and createdb --locale arguments. Previously, LOCALE (and --locale) only affected the database default collation when using the libc provider. Discussion: https://postgr.es/m/1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com Reviewed-by: Peter Eisentraut
Diffstat (limited to 'src/bin/scripts/createdb.c')
-rw-r--r--src/bin/scripts/createdb.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index b4205c4fa51..9ca86a3e53d 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -164,14 +164,6 @@ main(int argc, char *argv[])
exit(1);
}
- if (locale)
- {
- if (!lc_ctype)
- lc_ctype = locale;
- if (!lc_collate)
- lc_collate = locale;
- }
-
if (encoding)
{
if (pg_char_to_encoding(encoding) < 0)
@@ -219,6 +211,11 @@ main(int argc, char *argv[])
appendPQExpBuffer(&sql, " STRATEGY %s", fmtId(strategy));
if (template)
appendPQExpBuffer(&sql, " TEMPLATE %s", fmtId(template));
+ if (locale)
+ {
+ appendPQExpBufferStr(&sql, " LOCALE ");
+ appendStringLiteralConn(&sql, locale, conn);
+ }
if (lc_collate)
{
appendPQExpBufferStr(&sql, " LC_COLLATE ");