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

2004-09-21 Thread Michael Paesold
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


psql-autocommit.diff
Description: Binary data

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] psql \set case sensitive for boolean (OFF/off)

2004-09-21 Thread Michael Paesold
I wrote:
 Patch attached. Is strcasecmp ok, or should pg_strcasecmp be used here?

I don't know how I did it, but this was the wrong patch. Correct patch
attached now.

Best Regards,
MIchael Paesold


variables.c.diff
Description: Binary data

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] psql \set case sensitive for boolean (OFF/off)

2004-09-21 Thread Peter Eisentraut
Am Dienstag, 21. September 2004 13:01 schrieb Michael Paesold:
 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.

In contrast, psql is case sensitive, so the current behavior is consistent.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [PATCHES] psql \set case sensitive for boolean (OFF/off)

2004-09-21 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes:
 Am Dienstag, 21. September 2004 13:01 schrieb Michael Paesold:
 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.

 In contrast, psql is case sensitive, so the current behavior is consistent.

True, but recognizing off case-insensitively seems like a painless
improvement.  What would it be likely to get wrong?  (I've forgotten
what the original backwards-compatibility issue alluded to in the
comment was all about, so maybe I'm missing something important.)

If anything I'd think we should migrate towards allowing all the same
alternatives that backend GUC accepts for booleans ...

regards, tom lane

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings