How to convert integer to boolean in insert - Mailing list pgsql-general

From JiangMiao
Subject How to convert integer to boolean in insert
Date
Msg-id 0a4b02a4-fb38-456e-8c64-e76d2f8434d4@d19g2000prh.googlegroups.com
Whole thread Raw
Responses Re: How to convert integer to boolean in insert
Re: How to convert integer to boolean in insert
List pgsql-general
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 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 any way to make pgsql implicit cast the integer to boolean?

Thanks
--
Miao

pgsql-general by date:

Previous
From: Eduardo Henrique
Date:
Subject: Postgres Security Checklist
Next
From: Thomas Kellerer
Date:
Subject: Re: How to convert integer to boolean in insert