Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Boolean type with PostgreSQL

$
0
0
Simple Postgres table:
CREATE TABLE public.test (
  id INTEGER NOT NULL, 
  val BOOLEAN NOT NULL, 
  CONSTRAINT test_pkey PRIMARY KEY(id)
);


Do this:
Yii::app()->db->createCommand()->insert('test', array(
		'id'=>1,
		'val'=>true,
	));

Everithing's allright:

Quote

Executing SQL: INSERT INTO "test" ("id", "val") VALUES (:id, :val). Bound with :id=1, :val=true


But doing this
Yii::app()->db->createCommand()->insert('test', array(
		'id'=>1,
		'val'=>false,
	));

I'm getting the error:

Quote

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


Am I wrong?

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>