X-Original-To: pgsql-sql@postgresql.org Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D8E6D475AFF for ; Fri, 21 Mar 2003 10:07:43 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.8/8.12.8) with ESMTP id h2LF7lub012628; Fri, 21 Mar 2003 10:07:48 -0500 (EST) To: Eric Veldhuyzen Cc: pgsql-sql@postgresql.org Subject: Re: cast of integer to bool doesn't work (anymore?) In-reply-to: <20030321133646.GC6540@opium.xs4all.nl> References: <20030321133646.GC6540@opium.xs4all.nl> Comments: In-reply-to Eric Veldhuyzen message dated "Fri, 21 Mar 2003 14:36:46 +0100" Date: Fri, 21 Mar 2003 10:07:47 -0500 Message-ID: <12627.1048259267@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200303/501 X-Sequence-Number: 12540 Eric Veldhuyzen writes: > # select 0::boolean; > bool=20 > ------ > f > (1 row) > Perfect. Not so perfect as you think --- 7.2 does not allow casting from int to bool any more than 7.3 does. Try this: regression=# select 1::int::boolean; ERROR: Cannot cast type 'integer' to 'boolean' 7.2 is interpreting your query like regression=# select '1'::boolean; bool ------ t (1 row) which still works in 7.3 --- but we tightened up the other case, for reasons I don't recall at the moment but you can find in the mailing list archives. regards, tom lane