Re: Updateable views... - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Updateable views...
Date
Msg-id 87znoa7xcg.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: Updateable views...  (Neil Conway <neilc@samurai.com>)
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:

> On Tue, 2003-03-04 at 15:26, Eric D Nielsen wrote:
> > The one place I haven't been able to use PostGreSQL to experiment is with
> > regards to updateable views.  I've found a few threads in -general and -hackers
> > (including one linked from the ToDo list), but they all seem to die out without
> > really reaching any sort of conclusion.  I've also seen that in many
> > cases it appears possible to use triggers/rules to simulate updateable views,
> > but that feels like an inelegant solution to me.
> 
> How so? A view is defined by ON SELECT rules; it seems natural, then,
> that an updateable view would be defined ON INSERT / ON UPDATE rules.
> AFAIK the only deficiency with the status quo is that the system does
> not automatically define those insertion rules for you (in the subset of
> cases where rules actually *can* be defined: for example, the view can't
> include aggregation/grouping, calls to a user-defined function, etc.)
> 
> If you'd like to work on getting PostgreSQL to make views updateable
> automatically, that would be cool -- AFAIK no one else is currently
> working on it.

Would the rules approach be able to handle inline views? Ie, queries like:

UPDATE (select * from a natural join b) set a.foo = b.foo

On Oracle this is often the most efficient way to write update queries where
the data is coming from other tables. 

--
greg



pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: XML ouput for psql
Next
From: Tatsuo Ishii
Date:
Subject: Re: Win32 Powerfail testing