Re: Why can't I put a BEFORE EACH ROW trigger on a view? - Mailing list pgsql-general

From Webb Sprague
Subject Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Date
Msg-id b11ea23c0702241655l4365c82byde85487b62935d4c@mail.gmail.com
Whole thread Raw
In response to Re: Why can't I put a BEFORE EACH ROW trigger on a view?  ("Webb Sprague" <webb.sprague@gmail.com>)
Responses Re: Why can't I put a BEFORE EACH ROW trigger on a view?  ("Karl O. Pinc" <kop@meme.com>)
List pgsql-general
I also think that a view is supposed to be just that -- a *view* of
underlying data, which in no way modifies the data.  I don't know much
about the design ideas behind  SQL, but I think this view of views
(haha) is an underlying assumption.  If you are modifying data when
you do a select on a view, you are probably not using SQL the way it
was intended (not that that is a bad thing, but ...)

Postgresql has "rules" which I *think* can rewrite select statements.
Rules are kind of a pain, but maybe what you want.

On 2/24/07, Webb Sprague <webb.sprague@gmail.com> wrote:
> >.  I have _additional_
> > constraints to place on modifications done through
> > views, and trickyness involved in modifying the
> > underlying tables.
>
> Write a function foo that returns a set, then a view:  "create view as
> select * from foo()".  Incorporate all the trickiness in the function,
> including variables, multiple temporary tables, whatever you need.
>

pgsql-general by date:

Previous
From: "Webb Sprague"
Date:
Subject: Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Why can't I put a BEFORE EACH ROW trigger on a view?