Re: Rules: A Modest Proposal - Mailing list pgsql-hackers

From Dan Colish
Subject Re: Rules: A Modest Proposal
Date
Msg-id 20091004192939.GB26246@funkstrom.spiretech.com
Whole thread Raw
In response to Re: Rules: A Modest Proposal  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On Sun, Oct 04, 2009 at 03:15:10PM -0400, Andrew Dunstan wrote:
> 
> 
> Dan Colish wrote:
> >When you speak of writing to a view, what do you mean exactly? Are we saying
> >refresh a view or update the parent tables of a view?
> >
> >
> 
> He means INSERT, UPDATE and DELETE operations on the view.
> 
> cheers
> 
> andrew
> 
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


How would you resolve where to perform these operations in the parent tables? I
have not discovered a good way to determine which tables a user would desire to
alter if the view contains a subset of data from the parent and these subsets do
not include the primary keys. Even with primary keys as members of a view, there
is a good potential for side effects.

For example, consider the following tables:

usernames, student_grades, course_listings

If you have a view joining all three tables and delete one row in the view, you
have the potential for deleting too much data from a parent table; ie, you
choose to delete a username and its associated grades but also end up deleteing
a course. You could also delete a course and end up deleting all the usernames
and the grades associated. 

--
--Dan



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Rules: A Modest Proposal
Next
From: Marko Tiikkaja
Date:
Subject: Re: Using results from INSERT ... RETURNING