I’m an absolute beginner using the YII framework. I’m trying to learn from the ‘Agile web application development with Yii 1.1 and PHP5’. As my database engine I use PostgreSQL 9.1.
In one of the examples the MySQL data type ‘datetime’ is used. The PostgreSQL equivalent is ‘timestamp’. This works well when you actually fill in a date in the form. When you leave the date empty and you save, Yii receives an error:
CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 7 ERROR: invalid input syntax for type timestamp with time zone: "". The SQL statement executed was: INSERT INTO "tbl_project" ("name", "description", "create_time", "create_user_id", "update_time", "update_user_id") VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5)
I googled for a bit and came at the a thread at code.google.com with Yii issue 2869 (sorry I’m not allowed to link to it).
In this thread the following is advised:
Can someone point me to an example on how to use the $timestampExpression and in what context?