I’m running locally with XAMPP 1.7.7; Completed the “Agile Web Application Dev with Yii 1.1 and PHP5” book; everything was perfect. I then needed to test with postgreSQL instead of mySQL, so I decided to run through some parts of the book again.
Get to the CRUD section, create a Project table, generate the Model and Controller. Now if I fill in all fields and click on create, the record is added, if I leave the dates blank I get an error even though all the fields are allowed to be NULL.
Where mySQL would insert a default timestamp of 00:00:00 , postgres dies with
CDbCommand failed to execute the SQL statement: SQLSTATE: Invalid datetime format: 7 ERROR: invalid input syntax for type timestamp: "" LINE 1: ... "update_time", "update_user_id") VALUES ('', '', '', NULL, ... ^. 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)
Why are spaces being saved instead of NULLs?
How can I make postrgesQL behave like mySQL without having to go modify a bunch of code for all the models?