Re: [GENERAL] How to convert integer to boolean in insert

2009-04-06 Thread Thomas Kellerer
Alvaro Herrera wrote on 06.04.2009 19:39: If that is a one-time thing, why not create the table with banned as an integer column and another boolean column (if your INSERTs are properly listing the column names), then after the import update the boolean to the casted integer value, drop the int

Re: [GENERAL] How to convert integer to boolean in insert

2009-04-06 Thread Alvaro Herrera
Thomas Kellerer wrote: > If that is a one-time thing, why not create the table with banned as an > integer column and another boolean column (if your INSERTs are properly > listing the column names), then after the import update the boolean to > the casted integer value, drop the integer and re

Re: [GENERAL] How to convert integer to boolean in insert

2009-04-05 Thread Tom Lane
Martijn van Oosterhout writes: > On Sun, Apr 05, 2009 at 04:14:37AM -0700, JiangMiao wrote: >> Is there any way to make pgsql implicit cast the integer to boolean? > You might want to create the cast temporarily and after the import > remove it again. The cast exists already, so he can't just "c

Re: [GENERAL] How to convert integer to boolean in insert

2009-04-05 Thread Martijn van Oosterhout
On Sun, Apr 05, 2009 at 04:14:37AM -0700, JiangMiao wrote: > and I found a way to add the cast > insert into foo(banned) values(0::boolean) > but I have a big table which dump from mysqldump and covert by > mysql2pgsql. all of boolean relation values is 0 instead of '0' or > FALSE. > > Is there an

Re: [GENERAL] How to convert integer to boolean in insert

2009-04-05 Thread Thomas Kellerer
JiangMiao wrote on 05.04.2009 13:14: for table foo banned:boolean When try run 'insert into foo(banned) values(0)' It returns ERROR: column "banned" is of type boolean but expression is of type integer LINE 1: insert into foo(banned) values(0) and I found a way to add the cast insert into

[GENERAL] How to convert integer to boolean in insert

2009-04-05 Thread JiangMiao
for table foo banned:boolean When try run 'insert into foo(banned) values(0)' It returns ERROR: column "banned" is of type boolean but expression is of type integer LINE 1: insert into foo(banned) values(0) and I found a way to add the cast insert into foo(banned) values(0::boolean) but I ha