Re: casting from integer to boolean

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Seb <spluque(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: casting from integer to boolean
Date: 2008-03-27 07:40:31
Message-ID: 20080327074031.GA5519@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 26, 2008 at 05:28:18PM -0500, Seb wrote:
> > INSERT INTO my_table (var_bool) VALUES ( CAST( 0 AS BOOLEAN )); or
> > INSERT INTO my_table (var_bool) VALUES (0::BOOLEAN);
>
> Thanks Richard. Is there a way to do it without changing the INSERT
> command? As I mentioned, there are many more columns of different
> types, so finding and replacing the VALUES would be very difficult.

Don't think anyone mentioned it, but if you could get it to output
quotes around the value, like:

INSERT INTO my_table (var_bool) VALUES ('0');

It will also work.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-03-27 07:50:27 Re: psql /usr/lib/libgcc dependency in pg 8.3
Previous Message Guillaume Lelarge 2008-03-27 07:13:09 Re: Survey: renaming/removing script binaries (createdb, createuser...)