From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | Sean Chittenden <chitt(at)speakeasy(dot)net>, Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: Casting INT4 to BOOL... |
Date: | 2004-10-12 03:48:51 |
Message-ID: | 27591.1097552931@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> On Mon, 11 Oct 2004, Sean Chittenden wrote:
>> I would posit that this is the desired behavior as it's consistent with
>> every language I can think of.
> However, AFAIK it's inconsitent with the type input function which
> supports '1' and '0' but not other integers.
So? The type input function also accepts 't', 'f', and other spellings
that are not in the input domain for an integer-to-bool coercion. Will
you argue we should remove those allowed inputs so that it can be 100%
compatible with the coercion?
The question for an integer-to-bool conversion is what is useful and
expected behavior for that conversion; I don't think that's necessarily
the same as what the textual conversion should do.
A possibly useful analogy is that real-to-integer coercion rounds off
fractions; it doesn't error out, even though the integer input function
won't take a string that includes a decimal point.
To pollute this abstract discussion with an actual fact ;-) ...
I note from recent discussion on the ODBC list that M$ Access likes
to use "-1" to represent TRUE. So it would certainly make life easier
for Access migrants if the int-to-bool coercion would accept -1.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2004-10-12 04:44:46 | Re: Casting INT4 to BOOL... |
Previous Message | Stephan Szabo | 2004-10-12 02:45:40 | Re: Casting INT4 to BOOL... |