summaryrefslogtreecommitdiff
path: root/src/bin/scripts/createdb.c
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2024-04-21 21:21:55 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2024-04-21 21:21:55 +0200
commit9e6faeb3249d420a22ad8a5fbcf093b272c02cb8 (patch)
tree0dad7726871c9aa04283cdf260c056e68f324104 /src/bin/scripts/createdb.c
parent75929b6cfaff143c28b3ba6bb8801dc67aab4a9b (diff)
createdb: compare strategy case-insensitive
When specifying the createdb strategy, the documentation suggests valid options are FILE_COPY and WAL_LOG, but the code does case-sensitive comparison and accepts only "file_copy" and "wal_log" as valid. Fixed by doing a case-insensitive comparison using pg_strcasecmp(), same as for other string parameters nearby. While at it, apply fmtId() to a nearby "locale_provider". This already did the comparison in case-insensitive way, but the value would not be double-quoted, confusing the parser and the error message. Backpatch to 15, where the strategy was introduced. Backpatch-through: 15 Reviewed-by: Tom Lane Discussion: https://postgr.es/m/90c6913a-1dd2-42b4-8365-ce3b09c39b17@enterprisedb.com
Diffstat (limited to 'src/bin/scripts/createdb.c')
-rw-r--r--src/bin/scripts/createdb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index 9ca86a3e53d..ef34b24890c 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -227,7 +227,7 @@ main(int argc, char *argv[])
appendStringLiteralConn(&sql, lc_ctype, conn);
}
if (locale_provider)
- appendPQExpBuffer(&sql, " LOCALE_PROVIDER %s", locale_provider);
+ appendPQExpBuffer(&sql, " LOCALE_PROVIDER %s", fmtId(locale_provider));
if (icu_locale)
{
appendPQExpBufferStr(&sql, " ICU_LOCALE ");