Re: Allow WHEN in INSTEAD OF triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow WHEN in INSTEAD OF triggers
Date: 2019-12-28 03:29:15
Message-ID: 16007.1577503755@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)org> writes:
> While noodling around with an upcoming patch to remove user-modifiable
> RULEs, I noticed that WHEN conditions were disallowed from INSTEAD OF
> triggers for no discernible reason. This patch removes that
> restriction.

This seems like a remarkably bad idea. The point of an INSTEAD OF
trigger is that it is guaranteed to handle the operation. What's
the system supposed to do with rows the trigger doesn't handle?

I notice that your patch doesn't even bother to test what happens,
but I'd argue that whatever it is, it's wrong. If you think that
"do nothing" or "throw an error" is appropriate, you can code that
inside the trigger. It's not PG's charter to make such a decision.

regards, tom lane

PS: I think your chances of removing rules are not good, either.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2019-12-28 03:44:14 Re: use CLZ instruction in AllocSetFreeIndex()
Previous Message Alvaro Herrera 2019-12-28 03:12:30 Re: Allow WHEN in INSTEAD OF triggers