Maybe someone can chare his expierience about Yii + PostgreSQL partitioned table. PostgreSQL part with partitioned tables, checks and triggers works great but i can't get Yii to love these tables..
Problem is that on insert into partitioned table PostgreSQL gives 0 rows affected
and i can't figure out how to workaround this.
Yii model thinks new record is not saved (but it is) and $Model->save();
return false and so afterSave()
is not working and so on.
All other methods as ->find()
or ->findAll()
are working well. Even if i update just now saved record throw yii all is ok and i get executed afterSave
as well. Problem is only with ->save()
part.
Update working because i have trigger only on inserting new rows.
I'm using trigger to split new data by tables. Maybe i need to modify trigger so postgres know what i'm forwarding new data to slave
table not master
?
One more thing. I added primary key to master
table so Yii Model (CActiveRecord) don't throw errors about table without pk. I know documentation does not suggest this, but i got it working this way. Just trying to give big picture of my situation.
Thanks!
You could try using rules as an alternative. As it rewrites the query I would expect it to return the correct number of affected rows. While triggers are in most cases better I think rules are better then inserting data in the master table and having to delete it again.
This is covered in paragraph 5.9.5 on this manual page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With