From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: 0/1 vs true/false |
Date: | 2003-07-24 04:15:02 |
Message-ID: | 877k68r261.fsf@stark.dyndns.tv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar> writes:
> This makes me wonder, what about 't' and 'f'?... will they disappear in
> newer versions of postgreSQL?
Nothing to do with the spec, but can I toss one comment in here:
Having booleans printed as 't' and 'f' is the single most annoying thing in
all of postgres.
I swear it has caused more bugs in my code than any single factor. The problem
is that any language driver that just treats all columns as text -- which is
presumably most if not all -- will receive the column as 't' and 'f'. Both of
which evaluate to true in virtually every language.
If it printed booleans as 0 and 1 then pretty much every language would be
able to interpret them properly.
Instead I have to have =='f' and =='t' strewn throughout my code everywhere
making it harder to read and extremely fragile. If I forget one anywhere I
silently get subtly broken semantics.
This problem might be reduced with the binary protocol since the language
drivers will be able to ship boolean values in binary format and allocate
variables of the appropriate type in the language. But still a lot of drivers
will just bind everything as text anyways, and the goal when casting values to
text should be to pick values that get interpreted appropriately.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Chad N. Tindel | 2003-07-24 04:36:06 | Comments in .sql files |
Previous Message | Tom Lane | 2003-07-24 04:00:25 | Re: SAP DB: The unsung Open Source DB |