Search Postgresql Archives

Re: Why can't I put a BEFORE EACH ROW trigger on a view?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 02/24/2007 06:55:45 PM, Webb Sprague wrote:
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 ...)

The postgresql docs say something like: Having lots of views
is the mark of good database design.

That's because views present the same data in various ways,
to different users as each user thinks of the data.  In general,
they allow good db design, and in a well designed db will
be incomprensibe to the average user, partly because it contains lots
of foreign keys to manage 1-to-many relationships.  If it
makes sense to make a view so the user can see the data
in a form they can understand, then it makes sense to
allow the user to update the same view of the data.

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

You can't rewrite select statments.  That's where I started.
Trying to do so turns your table into a view, which then
can't have triggers.

Karl <kop@xxxxxxxx>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux