Re: rules, triggers and views - Mailing list pgsql-hackers

From Tom Lane
Subject Re: rules, triggers and views
Date
Msg-id 19535.1102287720@sss.pgh.pa.us
Whole thread Raw
In response to rules, triggers and views  (elein <elein@varlena.com>)
Responses Re: rules, triggers and views
List pgsql-hackers
elein <elein@varlena.com> writes:
> Also, what are the reasons for forbidding triggers on views?

The fact that they'd never fire (or better never fire).  A view does not
actually store any tuples, so update and delete triggers on it are
certainly useless.  You could imagine allowing BEFORE INSERT triggers,
with the understanding that nothing will be inserted no matter what the
trigger returns ... but such a trigger is still useless unless we remove
the safety restriction that says you can't INSERT into a view without
having an ON INSERT DO INSTEAD rule.

What you are probably wishing you had is some sort of ability to trigger
on "virtual", pre-rewriter operations, but the executor and the trigger
mechanism know nothing of this.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 8.0.0beta5 FailedAssertion (Crash) when casting composite types
Next
From: Bruce Momjian
Date:
Subject: Re: WIN1252 encoding - backend or not?