Thread: Trigger tuple slotification (extracted from pluggable storage patch)

Trigger tuple slotification (extracted from pluggable storage patch)

From
Amit Khandekar
Date:
Hi,

In [1],  there was a plan to do the trigger tuple slotification
changes as a separate patch, and not include them in the pluggable
storage changes. I have come up with such a patch by extracting the
trigger-specific changes from the pluggable storage changes proposed
in [1]. I used this repository to extract the changes :
https://github.com/anarazel/postgres-pluggable-storage.git

Extracted changes from this commit :

commit 6066202a97c9a2d540fd2a2e5fd2cad22f307cd2
Author: Andres Freund <andres@anarazel.de>
Date:   Tue Oct 2 22:15:23 2018 -0700

    Pluggable Storage.

Basically, the attached patch contains changes that slotify the
trigger tuple handling. Details below :

In the pluggable storage changes, there were some TODOs such as this
in trigger.c :
-               /* TODO : */
-               if (false && oldtuple != newtuple && oldtuple != slottuple)

I removed this condition. Andres, you had put this in the pluggable
storage patch, probably to check whether it is important. But after
giving a thought, I think it is not required.

Did all the slotification changes in ri_trigger.c also, because they
are all dependent on the slotification of Trigger tuples.

In AfterTriggerSaveEvent(), newslot->tts_tid value is copied over to
new_event.ate_ctid1. Since this function only accepts slot now,
there's no point in retrieving the tid from the slot tuple since later
on we are going to have tid in the slot, looking at the pluggable
storage changes. So in a separate patch
(0001-Populate-slot-tts_tid-wherever-tuple-t_self-changes.patch), I
have just added this field in the TupleTableSlot, and populated
slot->tts_tid wherever tuple->t_self changes.

[1] https://commitfest.postgresql.org/14/1283/

-- 
Thanks,
-Amit Khandekar
EnterpriseDB Corporation
The Postgres Database Company

Attachment