psql \set case sensitive for boolean (OFF/off)

Поиск
Список
Период
Сортировка
От Michael Paesold
Тема psql \set case sensitive for boolean (OFF/off)
Дата
Msg-id 016a01c49fca$59f2a1a0$ad01a8c0@zaphod
обсуждение исходный текст
Ответы Re: psql \set case sensitive for boolean (OFF/off)
Список pgsql-patches
psql is currently case sensitive for boolean values in \set, only "off" is
regarded as off, whereas "OFF" is regarded as on.

There is a comment in the code that explains, why other values than "off"
are always treated as true:
"for backwards compatibility, anything except "off" is taken as "true"

I would recommend to make this check at least case insensitive, because

a) Since SQL is case insensitive, the current behaviour is not what you
would expect.

b) I have stumbled over this myself (setting AUTOCOMMIT to 'OFF' and then
having problems because it was on)

c) I think there are other who were/will be bitten by this (recommendation
on general to use --set AUTOCOMMIT=OFF...)


I would change strcmp to strcasecmp in GetVariableBool in variable.c. For
the other functions (VariableEquals e.g.) I cannot speak, since I don't know
if the case sensitivity is needed.

Patch attached. Is strcasecmp ok, or should pg_strcasecmp be used here?

Best Regards,
Michael Paesold

Вложения

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

Предыдущее
От: "Michael Paesold"
Дата:
Сообщение: Re: Fix for VACUUM in psql autocommit off
Следующее
От: "Michael Paesold"
Дата:
Сообщение: Re: psql \set case sensitive for boolean (OFF/off)