Re: Rules: A Modest Proposal

From: Dan Colish <dan(at)unencrypted(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Rules: A Modest Proposal
Date: 2009-10-04 19:29:39
Message-ID: 20091004192939.GB26246@funkstrom.spiretech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2009-10-04 19:31:42 Re: Using results from INSERT ... RETURNING
Previous Message David Fetter 2009-10-04 19:27:39 Re: Rules: A Modest Proposal