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

From Bruce Momjian
Subject Re: Casting INT4 to BOOL...
Date
Msg-id 200502271522.j1RFMea20686@candle.pha.pa.us
Whole thread Raw
In response to Re: Casting INT4 to BOOL...  (Sean Chittenden <chitt@speakeasy.net>)
List pgsql-patches
Patch applied by Neil.  Thanks.

---------------------------------------------------------------------------


Sean Chittenden wrote:
> >> 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, skipping... ]

>
>
> --
> Sean Chittenden

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: [BUGS] BUG #1466: #maintenace_work_mem = 16384
Next
From: Thomas Hallgren
Date:
Subject: Patch that deals with that AtCommit_Portals encounters deleted entries