Update rule on a view - what am I doing wrong - Mailing list pgsql-general

From Leif Jensen
Subject Update rule on a view - what am I doing wrong
Date
Msg-id 896712.17467.1358518747042.JavaMail.root@quick
Whole thread Raw
Responses Re: Update rule on a view - what am I doing wrong
List pgsql-general
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

Attachment

pgsql-general by date:

Previous
From: Igor Neyman
Date:
Subject: Re: speeding up a join query that utilizes a view
Next
From: Tom Lane
Date:
Subject: Re: String comparison and the SQL standard