pgsql: Use slots in trigger infrastructure,except for the actual invoc - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: Use slots in trigger infrastructure,except for the actual invoc
Date
Msg-id E1gyr28-0004d8-5t@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Use slots in trigger infrastructure, except for theactual invoc  (Andres Freund <andres@anarazel.de>)
Re: pgsql: Use slots in trigger infrastructure, except for the actual invoc  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
Use slots in trigger infrastructure, except for the actual invocation.

In preparation for abstracting table storage, convert trigger.c to
track tuples in slots. Which also happens to make code calling
triggers simpler.

As the calling interface for triggers themselves is not changed in
this patch, HeapTuples still are extracted from the slot at that
time. But that's handled solely inside trigger.c, not visible to
callers. It's quite likely that we'll want to revise the external
trigger interface, but that's a separate large project.

As part of this work the slots used for old/new/return tuples are
moved from EState into ResultRelInfo, as different updated tables
might need different slots. The slots are now also now created
on-demand, which is good both from an efficiency POV, but also makes
the modifying code simpler.

Author: Andres Freund, Amit Khandekar and Ashutosh Bapat
Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ff11e7f4b9ae017585c3ba146db7ba39c31f209a

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c      |  16 +-
src/backend/commands/copy.c              |  24 +-
src/backend/commands/tablecmds.c         |   2 -
src/backend/commands/trigger.c           | 673 ++++++++++++++++---------------
src/backend/executor/execMain.c          |   6 +-
src/backend/executor/execReplication.c   |  25 +-
src/backend/executor/execTuples.c        |   4 +
src/backend/executor/execUtils.c         |  69 +++-
src/backend/executor/nodeModifyTable.c   | 166 +++-----
src/backend/replication/logical/worker.c |   5 -
src/backend/utils/adt/ri_triggers.c      | 187 +++++----
src/include/commands/trigger.h           |  24 +-
src/include/executor/executor.h          |   4 +
src/include/nodes/execnodes.h            |   8 +-
14 files changed, 642 insertions(+), 571 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Add ExecStorePinnedBufferHeapTuple.
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix memory leak when inserting tuple at relation creation forCT