Hello,
I have been fighting a problem with an update rule on a view. I have a view that combines two tables where the 'sub'
table(scont) can have several rows per row in the 'top' table (icont). The view combines these to show only one record
perrow in the top table. To be able to update on this view I have created a rule 'on update'. The rule needs to have
bothUPDATE, DELETE, and INSERT commands. Is this not possible or am I doing something else wrong ?
In the included sql script I have tried to show the problem. When the final update statement is executed, I get a
'duplicatekey violation' on a record that has never been there.
I am using PostgreSQL version 9.1.7 (running on Linux/Ubuntu 12.04). What am I doing wrong ?
Please help,
Leif