[PATCH] Allow queries in WHEN expression of FOR EACH STATEMENT triggers

From: "Joe Wildish" <joe(at)lateraljoin(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Allow queries in WHEN expression of FOR EACH STATEMENT triggers
Date: 2020-07-16 22:22:13
Message-ID: C47C490A-BAEC-4879-BC96-737BB4BF3DC1@lateraljoin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Attached is a patch for supporting queries in the WHEN expression of
statement triggers. It is restricted so that the expression can
reference only the transition tables and the table to which the trigger
is attached. This seemed to make the most sense in that it follows what
you can do in the per row triggers. I did have a look in the standards
document about triggers, and couldn't see any restrictions mentioned,
but nevertheless thought it made most sense.

One possibility controversial aspect is that the patch doesn't use SPI
to evaluate the expression; it constructs a Query instead and passes it
to the executor. Don't know what people's thoughts are on doing that?

-Joe

Attachment Content-Type Size
0001-Allow-queries-in-WHEN-expression-of-FOR-EACH-STATEME.patch text/plain 48.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hsu, John 2020-07-16 22:54:49 Re: Physical slot restart_lsn advances incorrectly requiring restore from archive
Previous Message David G. Johnston 2020-07-16 21:55:54 Improve Managing Databases Overview Doc Page