• Andres Freund's avatar
    Store tuples for EvalPlanQual in slots, rather than as HeapTuples. · ad0bda5d
    Andres Freund authored
    For the upcoming pluggable table access methods it's quite
    inconvenient to store tuples as HeapTuples, as that'd require
    converting tuples from a their native format into HeapTuples. Instead
    use slots to manage epq tuples.
    
    To fit into that scheme, change the foreign data wrapper callback
    RefetchForeignRow, to store the tuple in a slot. Insist on using the
    caller provided slot, so it conveniently can be stored in the
    corresponding EPQ slot.  As there is no in core user of
    RefetchForeignRow, that change was done blindly, but we plan to test
    that soon.
    
    To avoid duplicating that work for row locks, move row locks to just
    directly use the EPQ slots - it previously temporarily stored tuples
    in LockRowsState.lr_curtuples, but that doesn't seem beneficial, given
    we'd possibly end up with a significant number of additional slots.
    
    The behaviour of es_epqTupleSet[rti -1] is now checked by
    es_epqTupleSlot[rti -1] != NULL, as that is distinguishable from a
    slot containing an empty tuple.
    
    Author: Andres Freund, Haribabu Kommi, Ashutosh Bapat
    Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
    ad0bda5d
tuptable.h 16.8 KB