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