Re: createdb compares strategy as case-sensitive

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: createdb compares strategy as case-sensitive
Дата
Msg-id 2568919.1713645640@sss.pgh.pa.us
обсуждение исходный текст
Ответ на createdb compares strategy as case-sensitive  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Ответы Re: createdb compares strategy as case-sensitive  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers
Tomas Vondra <tomas.vondra@enterprisedb.com> writes:
> While doing some testing with createdb, I noticed it only accepts
> file_copy/wal_log as valid strategies, not FILE_COPY/WAL_LOG (which is
> what the docs say). The same thing applies to CREATE DATABASE.

Hmm, actually it does work in CREATE DATABASE:

regression=# create database foo STRATEGY = FILE_COPY;
CREATE DATABASE

but it fails in createdb because that does

    if (strategy)
        appendPQExpBuffer(&sql, " STRATEGY %s", fmtId(strategy));

and fmtId will double-quote the strategy if it's upper-case, and then
the backend grammar doesn't case-fold it, and kaboom.

> The problem is that createdb() does the check using strcmp() which is
> case-sensitive. IMHO this should do pg_strcasecmp() which is what we do
> for other string parameters nearby.

Seems reasonable.  The alternative could be to remove createdb.c's use
of fmtId() here, but I don't think that's actually better.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: createdb compares strategy as case-sensitive
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: createdb compares strategy as case-sensitive