Re: Casting INT4 to BOOL...

From: Sean Chittenden <chitt(at)speakeasy(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Casting INT4 to BOOL...
Date: 2004-10-11 18:32:59
Message-ID: F9F6628E-1BB3-11D9-BCB2-000A95C705DC@speakeasy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

>> Is there any reason why the backend doesn't cast an unquoted integer
>> to
>> a boolean value?
>
> Hidden cross-category typecasts are evil. I'd accept this as an
> explicit cast ('e' in pg_cast) but not automatic.
>
> Also, what about the other direction? Providing a cast in only one
> direction is pretty inconsistent.

test=> SELECT 1::BOOL, 0::BOOL, TRUE::INT4, FALSE::INT4;
bool | bool | int4 | int4
------+------+------+------
t | f | 1 | 0
(1 row)

Okey doke, both directions are now provided and the cast has to be
explicit. -sc

Attachment Content-Type Size
patch.txt text/plain 3.8 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Sean Chittenden 2004-10-11 18:42:32 Re: Slightly better testing for pg_ctl(1)'s -w...
Previous Message Tom Lane 2004-10-11 18:21:37 Re: plperl features