Re: postgres_fdw: batch inserts vs. before row triggers
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>,
Etsuro Fujita <etsuro.fujita@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-08-03T21:57:57Z
Lists: pgsql-hackers
Matthias van de Meent <boekewurm+postgres@gmail.com> writes: > I don't have a current version of the SQL spec, but one preliminary > version of SQL:2012 I retrieved via the wiki details that all BEFORE > triggers on INSERT/UPDATE/DELETE statements are all executed before > _any_ of that statements' affected data is modified. > ... > I don't know about the semantics of triggers in the latest SQL > standard versions, but based on that sample it seems like we're > non-compliant on BEFORE trigger behaviour, and it doesn't seem like > it's documented in the trigger documentation. I think we're compliant if you declare the trigger functions as stable (or immutable, but in any case where this matters, I think you'd be lying). They'll then run with the snapshot of the calling query, in which those updates are not yet visible. This is documented somewhere, but maybe not anywhere near triggers. regards, tom lane
Commits
-
Remove new structure member from ResultRelInfo.
- d43a97ef493a 14.7 landed
- a0bf7a0eccbf 15.2 landed
- 4b3e37993254 16.0 landed
-
Fix handling of pending inserts in nodeModifyTable.c.
- e52245228ecf 14.7 landed
- fc02019c09fe 15.2 landed
- ffbb7e65a873 16.0 landed
-
postgres_fdw: Disable batch insertion when there are WCO constraints.
- 4a9bc2e0f522 14.5 landed
- 1d49db259884 15.0 landed
- 82593b9a3d5f 16.0 landed
-
postgres_fdw: Disable batch insert when BEFORE ROW INSERT triggers exist.
- 89d349b0a023 14.3 landed
- 4eea2202bead 15.0 landed
-
Implement support for bulk inserts in postgres_fdw
- b663a4136331 14.0 cited