aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-09-13 14:18:45 +0200
committerPeter Eisentraut <peter@eisentraut.org>2022-09-13 14:18:45 +0200
commit3e694b318d20c876a3fd64f8e44d2ba5eab7a022 (patch)
tree61486951547d78163c2950bd8483c4601bf2484c
parent892cac91249921af73cfe5a7209b64a16589ae18 (diff)
downloadpostgresql-3e694b318d20c876a3fd64f8e44d2ba5eab7a022.tar.gz
postgresql-3e694b318d20c876a3fd64f8e44d2ba5eab7a022.zip
Make locale option behavior more consistent
Locale options can be specified for initdb, createdb, and CREATE DATABASE. In initdb, it has always been possible to specify --locale and then some --lc-* option to override a category. CREATE DATABASE and createdb didn't allow that, requiring either the all-categories option or only per-category options. In f2553d43060edb210b36c63187d52a632448e1d2, this was changed in CREATE DATABASE (perhaps by accident?) to be more like the initdb behavior, but createdb still had the old behavior. Now we change createdb to match the behavior of CREATE DATABASE and initdb, and also update the documentation of CREATE DATABASE to match the new behavior, which was not done in the above commit. Author: Marina Polyakova <m.polyakova@postgrespro.ru> Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> Discussion: https://www.postgresql.org/message-id/7c99c132dc9c0ac630e0127f032ac480@postgrespro.ru
-rw-r--r--doc/src/sgml/ref/create_database.sgml3
-rw-r--r--src/bin/scripts/createdb.c10
2 files changed, 5 insertions, 8 deletions
diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml
index 0ce0bd8a1a6..ea38c647313 100644
--- a/doc/src/sgml/ref/create_database.sgml
+++ b/doc/src/sgml/ref/create_database.sgml
@@ -145,8 +145,7 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
<listitem>
<para>
This is a shortcut for setting <symbol>LC_COLLATE</symbol>
- and <symbol>LC_CTYPE</symbol> at once. If you specify this,
- you cannot specify either of those parameters.
+ and <symbol>LC_CTYPE</symbol> at once.
</para>
<tip>
<para>
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index e523e58b218..a1482df3d98 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -161,12 +161,10 @@ main(int argc, char *argv[])
if (locale)
{
- if (lc_ctype)
- pg_fatal("only one of --locale and --lc-ctype can be specified");
- if (lc_collate)
- pg_fatal("only one of --locale and --lc-collate can be specified");
- lc_ctype = locale;
- lc_collate = locale;
+ if (!lc_ctype)
+ lc_ctype = locale;
+ if (!lc_collate)
+ lc_collate = locale;
}
if (encoding)