Re: Casting INT4 to BOOL... - Mailing list pgsql-patches

From Sean Chittenden
Subject Re: Casting INT4 to BOOL...
Date
Msg-id F9F6628E-1BB3-11D9-BCB2-000A95C705DC@speakeasy.net
Whole thread Raw
In response to Re: Casting INT4 to BOOL...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Casting INT4 to BOOL...
Re: Casting INT4 to BOOL...
List 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



--
Sean Chittenden

Attachment

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: plperl features
Next
From: Sean Chittenden
Date:
Subject: Re: Slightly better testing for pg_ctl(1)'s -w...