pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Eric Veldhuyzen <ericv@xs4all.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: cast of integer to bool doesn't work (anymore?)
Date: Fri, 21 Mar 2003 10:07:47 -0500
Message-ID: <12627.1048259267@sss.pgh.pa.us> (raw)
In-Reply-To: <20030321133646.GC6540@opium.xs4all.nl>
References: <20030321133646.GC6540@opium.xs4all.nl>

Eric Veldhuyzen <ericv@xs4all.net> 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



view thread (7+ messages)  latest in thread

Message-ID: <12627.1048259267@sss.pgh.pa.us>
Permalink:  ../12627.1048259267@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12627.1048259267@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ericv@xs4all.net
  Subject: Re: cast of integer to bool doesn't work (anymore?)
  In-Reply-To: <12627.1048259267@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox