Re: Views: having a rule call a function vs. using a before trigger

Поиск
Список
Период
Сортировка
От Ken Downs
Тема Re: Views: having a rule call a function vs. using a before trigger
Дата
Msg-id jdtinh.7kvha9@dhost2.secdat.com
обсуждение исходный текст
Ответ на Views: having a rule call a function vs. using a before trigger  ("Karl O. Pinc" <kop@meme.com>)
Список pgsql-general
"Karl O. Pinc" <kop@meme.com> wrote:

> Hi,
>
> Postgresql 8.1.
>
> I'm trying to come up with a generic way
> of inserting into a view, particularly regards
> error testing and the generation of complicated
> foreign keys. I don't seem to be having much luck.
>
> (I also want to update and delete, but haven't gotten
> that far.)

Before I mount too much of a reply, may I ask in particular
why you are targeting views? Reason I ask is that I've gone
through the same
process and have worked out a general
approach to implementing all biz logic
in triggers.

However, as the biz logic is defined in terms of tables, we
attached all logic always to tables. When for whatever
reason the user is
going through a view, the rule sends it
back to the base table where the biz
logic takes care of it
there.

This avoids attempting to redefine or
recast the rules in
the context of any particular view.

So that is why I am
asking why in particular you
are asking about views.


>
> I thought that, for inserts at least, I could write
> a rule that called a function and have the function
> do anything complicated, raise exceptions, etc.
> But I get the error message shown below.
>

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

Предыдущее
От: "Michael Nolan"
Дата:
Сообщение: How can you tell if a function is immutable from psql?
Следующее
От: cedric
Дата:
Сообщение: Re: Slow running to_tsvector (tsearch2 in PG 8.2.3)