createdb: compare strategy case-insensitive

Tomas Vondra <tomas.vondra@postgresql.org>

Commit: 276b7888f161bb149217a55008d7f7c17126f9a4
Author: Tomas Vondra <tomas.vondra@postgresql.org>
Date: 2024-04-21T19:22:11Z
Releases: 15.7
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

Files

PathChange+/−
src/backend/commands/dbcommands.c modified +3 −3
src/bin/scripts/createdb.c modified +1 −1
src/bin/scripts/t/020_createdb.pl modified +10 −0

Discussion