很麻烦,PostgreSQL不支持integer到boolean的转换

如数据库test拥有字段
banned boolean 

使用命令
insert into test(banned) values (0)

返回为

 

ERROR:  column "banned" is of type boolean but expression is of type integer

LINE 1: insert into test(banned) values(0)
很是不方便。用cast也没用 
难到只能用规定的 TRUE,'t','true','y','yes','1'吗?

但奇怪的是select 0::boolean支能显示false

发表评论

电子邮件地址不会被公开。 必填项已被标记为 *

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>