Re: Proposal / proof of concept: Triggers on VIEWs - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: Proposal / proof of concept: Triggers on VIEWs
Date
Msg-id 4C595B9E.4000208@cs.helsinki.fi
Whole thread Raw
In response to Proposal / proof of concept: Triggers on VIEWs  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Proposal / proof of concept: Triggers on VIEWs
List pgsql-hackers
On 8/4/10 2:39 PM +0300, Dean Rasheed wrote:
> Does this sound like a useful feature? Is this a sane approach to
> implementing it? If not, has anyone else given any thought as to how
> it might be implemented?

I didn't look at the patch, but so far, I've identified three problems 
with the existing view system:
    1) You can't re-evaluate the UPDATE expression like an UPDATE on a       table does.  Consider for example  UPDATE
fooSET a=a+1;  If the       tuples change before we get to them, we lose data because we       simply can't re-evaluate
"a+1"in the trigger.
 
    2) You can't set the number of affected rows.
    3) You can't set the RETURNING results.  You suggested that       RETURNING for DELETE would return the OLD value,
butthat seems       broken because that's not necessarily what was deleted.  I didn't       understand what you
suggestionfor UPDATE was; how does PG know       that if the view doesn't have a primary key?
 

I think these are the main three problems that prevent people from 
actually using views, and I think these should be focused on when adding 
triggers on VIEWS.  I would love to see the feature though.

Any thoughts?


Regards,
Marko Tiikkaja


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: merge command - GSoC progress
Next
From: Heikki Linnakangas
Date:
Subject: Re: merge command - GSoC progress