Re: rules, triggers and views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: elein <elein(at)varlena(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, David Fetter <david(at)fetter(dot)org>
Subject: Re: rules, triggers and views
Date: 2004-12-05 23:02:00
Message-ID: 19535.1102287720@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

elein <elein(at)varlena(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-12-05 23:46:11 Re: WIN1252 encoding - backend or not?
Previous Message Tom Lane 2004-12-05 22:42:10 Re: 8.0.0beta5 FailedAssertion (Crash) when casting composite types