Search Postgresql Archives

Re: casting from integer to boolean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 26, 2008 at 2:58 PM, Seb <spluque@xxxxxxxxx> wrote:
> INSERT INTO my_table (var_bool) VALUES (0);
> INSERT INTO my_table (var_bool) VALUES (1);
>
> So this results in an error.  Unfortunately, there are many more columns
> and it would be very difficult to write a regexp to replace the 0s and
> 1s with their quoted versions.  Is there any way to make such INSERT
> commands be valid?  I have no experience with CAST, so any pointers
> would be welcome.  Thanks.

INSERT INTO my_table (var_bool) VALUES ( CAST( 0 AS BOOLEAN ));
or
INSERT INTO my_table (var_bool) VALUES (0::BOOLEAN);


-- 
Regards,
Richard Broersma Jr.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux