简单的 Postgres 表:
CREATE TABLE public.test (
id INTEGER NOT NULL,
val BOOLEAN NOT NULL,
CONSTRAINT test_pkey PRIMARY KEY(id)
);
这样做:
Yii::app()->db->createCommand()->insert('test', array(
'id'=>1,
'val'=>true,
));
万事如意:
Executing SQL: INSERT INTO "test" ("id", "val") VALUES (:id, :val). Bound with :id=1, :val=true
但是这样做
Yii::app()->db->createCommand()->insert('test', array(
'id'=>1,
'val'=>false,
));
我收到错误:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type boolean: ""
LINE 1: INSERT INTO "test" ("id", "val") VALUES ('1', '')
^. The SQL statement executed was: INSERT INTO "test" ("id", "val") VALUES (:id, :val). Bound with :id=1, :val=false
我错了吗?