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

Поиск
Список
Период
Сортировка
От Karl O. Pinc
Тема Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Дата
Msg-id 1172366424l.30468l.9l@mofo
обсуждение исходный текст
Ответ на Re: Why can't I put a BEFORE EACH ROW trigger on a view?  ("Webb Sprague" <webb.sprague@gmail.com>)
Список pgsql-general
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@meme.com>
Free Software:  "You don't pay back, you pay forward."
                  -- Robert A. Heinlein


В списке pgsql-general по дате отправления:

Предыдущее
От: "Karl O. Pinc"
Дата:
Сообщение: Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Why can't I put a BEFORE EACH ROW trigger on a view?