Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Updatable views

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org,Bernd Helmle <mailings(at)oopsware(dot)de>,Alvaro Herrera <alvherre(at)commandprompt(dot)com>,Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Updatable views
Date: 2006-08-31 14:35:14
Message-ID: 200608311635.17515.peter_e@gmx.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Am Donnerstag, 31. August 2006 15:55 schrieb Tom Lane:
> >> I'm unclear as to why you've got DO INSTEAD NOTHING rules in there ---
> >
> > You need to have one unconditional rule if you have a bunch of
> > conditional ones.  The system does not see through the fact that the
> > conditional ones cover all cases.
>
> AFAICS, for the cases we are able to implement within the existing rule
> mechanism, there should be exactly one unconditional rule.  If you
> propose more, then you are going to have insurmountable problems with
> the usual sorts of multiple-evaluation risks.

I'm not sure what you are saying here ...

The implementation creates, for each of the three actions INSERT, UPDATE, 
DELETE, one conditional rule that redirects the action from the view into the 
unterlying table, conditional on the view condition being fulfilled.  The 
unconditional DO INSTEAD NOTHING rule then catches the cases where the view 
condition is not fulfilled.  So there is, for each action, exactly one 
conditional and one unconditional rule.  Which is consistent with what you 
said above, so I don't see the problem.

> The proposed WITH CHECK OPTION implementation is unworkable for exactly
> this reason --- it will give the wrong answers in the presence of
> volatile functions such as nextval().

I'm not sure why anyone would want to define a view condition containing a 
volatile function.  At least it wouldn't put a major dent into this feature 
if such views were decreed not updatable.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

pgsql-hackers by date

Next:From: Phil FrostDate: 2006-08-31 14:41:20
Subject: Re: Prepared statements considered harmful
Previous:From: Chris BrowneDate: 2006-08-31 14:33:36
Subject: gBorg status?

pgsql-patches by date

Next:From: Tom LaneDate: 2006-08-31 15:10:47
Subject: Re: [HACKERS] Updatable views
Previous:From: Tom LaneDate: 2006-08-31 13:55:53
Subject: Re: [HACKERS] Updatable views

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group