First app problem with Postgresql

I tried to test Yii with Postgresql and nothing work.

I set my DB connection in the main.php config file as this :

'db'=>array(

                        'class'=>'CDbConnection',

		'connectionString'=>'pgsql:host=myhost;port=5432;dbname=mydb',

                        'charset' => 'utf8',

                        'username'=>'root',

                        'password'=>'test',

	),

When I try to generate the model with : model Languages languages I receive the following error :

Internal Server error

Illegal offset type in isset or empty

I tried this on 2 different servers and get the same error.

Note : I tested PDO within another PHP file and everything work so DBO works.

Any clue ?

Does your database contain a foreign key named 'id' ?

No foreign key but a primary key

Here is the definition…

CREATE TABLE languages

(

  id integer NOT NULL DEFAULT nextval(('"public"."languages_id_seq"'::text)::regclass),

  code character(2),

  image character varying(100),

  CONSTRAINT languages_pkey PRIMARY KEY (id)

)

In fact I have another table with foreign key to this one.

The table look like this :

CREATE TABLE languages_i18n

(

  id integer NOT NULL DEFAULT nextval(('"public"."languages_i18n_id_seq"'::text)::regclass),

  culture character varying(7) NOT NULL,

  "name" character varying(50),

  created_at timestamp(0) without time zone,

  updated_at timestamp(0) without time zone,

  CONSTRAINT languages_i18n_pkey PRIMARY KEY (id, culture),

  CONSTRAINT languages_i18n_id_fkey FOREIGN KEY (id)

      REFERENCES languages (id) MATCH SIMPLE

      ON UPDATE CASCADE ON DELETE CASCADE

)

I tested it with tables without foreign keys and get the same error.

So you do have a FK named ‘id’. ;)

Yes, this is a bug that was fixed in SVN already.