From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Sync BEFORE STATEMENT trigger behavior with AFTER STATEMENT |
Date: | 2017-09-16 18:03:12 |
Message-ID: | 22315.1505584992@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The just-committed patch 0f79440fb arranges to suppress extra firings
of AFTER STATEMENT triggers that historically have occurred when
several FK enforcement trigger firings affect the same target table.
This leaves us in a situation where you may get more BEFORE STATEMENT
trigger firings than AFTER STATEMENT firings, which seems weird.
I did the attached simple patch to change this, using state very
similar to that now used for AFTER STATEMENT triggers. It works, in
terms of syncing the number of trigger calls. The timing of the
calls might seem a bit weird, as shown in the modified regression
test case. In the corner cases where you can get multiple statement
trigger firings out of one original SQL statement, the ordering
tends to look like
BEFORE STATEMENT
BEFORE STATEMENT
AFTER STATEMENT
AFTER STATEMENT
not what you might expect,
BEFORE STATEMENT
AFTER STATEMENT
BEFORE STATEMENT
AFTER STATEMENT
I'm not sure there's anything we can or should do about that, though.
Certainly we don't want to delay the execution of BEFORE calls.
I think we should push this into v10 so that we maintain consistency
of BEFORE vs. AFTER STATEMENT behavior. Objections?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fire-before-stmt-triggers-once.patch | text/x-diff | 8.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2017-09-16 18:19:46 | Re: [PATCH]make pg_rewind to not copy useless WAL files |
Previous Message | Peter Geoghegan | 2017-09-16 17:54:45 | Re: A design for amcheck heapam verification |