diff options
author | Andres Freund <andres@anarazel.de> | 2019-02-26 20:30:28 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-02-26 20:31:38 -0800 |
commit | ff11e7f4b9ae017585c3ba146db7ba39c31f209a (patch) | |
tree | 37828b8d2ab7bda386b276129b456793c7ac908b /src/include/commands/trigger.h | |
parent | b8d71745eac0a12740a70dc78cbcdedadade37f8 (diff) | |
download | postgresql-ff11e7f4b9ae017585c3ba146db7ba39c31f209a.tar.gz postgresql-ff11e7f4b9ae017585c3ba146db7ba39c31f209a.zip |
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
Diffstat (limited to 'src/include/commands/trigger.h')
-rw-r--r-- | src/include/commands/trigger.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index 9f212ac24bf..846679ecc12 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -35,8 +35,8 @@ typedef struct TriggerData HeapTuple tg_trigtuple; HeapTuple tg_newtuple; Trigger *tg_trigger; - Buffer tg_trigtuplebuf; - Buffer tg_newtuplebuf; + TupleTableSlot *tg_trigslot; + TupleTableSlot *tg_newslot; Tuplestorestate *tg_oldtable; Tuplestorestate *tg_newtable; } TriggerData; @@ -77,9 +77,9 @@ typedef struct TransitionCaptureState * format to parent format after they have already been converted in the * opposite direction during routing. In that case we bypass conversion * and allow the inserting code (copy.c and nodeModifyTable.c) to provide - * the original tuple directly. + * a slot containing the original tuple directly. */ - HeapTuple tcs_original_insert_tuple; + TupleTableSlot *tcs_original_insert_tuple; /* * Private data including the tuplestore(s) into which to insert tuples. @@ -186,15 +186,15 @@ extern void ExecBSInsertTriggers(EState *estate, extern void ExecASInsertTriggers(EState *estate, ResultRelInfo *relinfo, TransitionCaptureState *transition_capture); -extern TupleTableSlot *ExecBRInsertTriggers(EState *estate, +extern bool ExecBRInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot); extern void ExecARInsertTriggers(EState *estate, ResultRelInfo *relinfo, - HeapTuple trigtuple, + TupleTableSlot *slot, List *recheckIndexes, TransitionCaptureState *transition_capture); -extern TupleTableSlot *ExecIRInsertTriggers(EState *estate, +extern bool ExecIRInsertTriggers(EState *estate, ResultRelInfo *relinfo, TupleTableSlot *slot); extern void ExecBSDeleteTriggers(EState *estate, @@ -221,7 +221,7 @@ extern void ExecBSUpdateTriggers(EState *estate, extern void ExecASUpdateTriggers(EState *estate, ResultRelInfo *relinfo, TransitionCaptureState *transition_capture); -extern TupleTableSlot *ExecBRUpdateTriggers(EState *estate, +extern bool ExecBRUpdateTriggers(EState *estate, EPQState *epqstate, ResultRelInfo *relinfo, ItemPointer tupleid, @@ -231,10 +231,10 @@ extern void ExecARUpdateTriggers(EState *estate, ResultRelInfo *relinfo, ItemPointer tupleid, HeapTuple fdw_trigtuple, - HeapTuple newtuple, + TupleTableSlot *slot, List *recheckIndexes, TransitionCaptureState *transition_capture); -extern TupleTableSlot *ExecIRUpdateTriggers(EState *estate, +extern bool ExecIRUpdateTriggers(EState *estate, ResultRelInfo *relinfo, HeapTuple trigtuple, TupleTableSlot *slot); @@ -258,9 +258,9 @@ extern bool AfterTriggerPendingOnRel(Oid relid); * in utils/adt/ri_triggers.c */ extern bool RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel, - HeapTuple old_row, HeapTuple new_row); + TupleTableSlot *old_slot, TupleTableSlot *new_slot); extern bool RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel, - HeapTuple old_row, HeapTuple new_row); + TupleTableSlot *old_slot, TupleTableSlot *new_slot); extern bool RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel); |