Perhaps it's just a matter of taste, but I think the TupleTableSlotOps
structure, once initialized, should be used wherever possible. At least for me
personally, when I read the code, the particular callback function name is a
bit disturbing wherever it's not necessary.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 55d1669db0..4989604d4e 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -248,7 +248,7 @@ tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
Assert(srcdesc->natts <= dstslot->tts_tupleDescriptor->natts);
- tts_virtual_clear(dstslot);
+ dstslot->tts_ops->clear(dstslot);
slot_getallattrs(srcslot);
@@ -262,7 +262,7 @@ tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)
dstslot->tts_flags &= ~TTS_FLAG_EMPTY;
/* make sure storage doesn't depend on external memory */
- tts_virtual_materialize(dstslot);
+ dstslot->tts_ops->materialize(dstslot);
}
static HeapTuple
@@ -399,7 +399,7 @@ tts_heap_get_heap_tuple(TupleTableSlot *slot)
Assert(!TTS_EMPTY(slot));
if (!hslot->tuple)
- tts_heap_materialize(slot);
+ slot->tts_ops->materialize(slot);
return hslot->tuple;
}
@@ -411,7 +411,7 @@ tts_heap_copy_heap_tuple(TupleTableSlot *slot)
Assert(!TTS_EMPTY(slot));
if (!hslot->tuple)
- tts_heap_materialize(slot);
+ slot->tts_ops->materialize(slot);
return heap_copytuple(hslot->tuple);
}
@@ -422,7 +422,7 @@ tts_heap_copy_minimal_tuple(TupleTableSlot *slot)
HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
if (!hslot->tuple)
- tts_heap_materialize(slot);
+ slot->tts_ops->materialize(slot);
return minimal_tuple_from_heap_tuple(hslot->tuple);
}
@@ -432,7 +432,7 @@ tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree)
{
HeapTupleTableSlot *hslot = (HeapTupleTableSlot *) slot;
- tts_heap_clear(slot);
+ slot->tts_ops->clear(slot);
slot->tts_nvalid = 0;
hslot->tuple = tuple;
@@ -567,7 +567,7 @@ tts_minimal_get_minimal_tuple(TupleTableSlot *slot)
MinimalTupleTableSlot *mslot = (MinimalTupleTableSlot *) slot;
if (!mslot->mintuple)
- tts_minimal_materialize(slot);
+ slot->tts_ops->materialize(slot);
return mslot->mintuple;
}
@@ -578,7 +578,7 @@ tts_minimal_copy_heap_tuple(TupleTableSlot *slot)
MinimalTupleTableSlot *mslot = (MinimalTupleTableSlot *) slot;
if (!mslot->mintuple)
- tts_minimal_materialize(slot);
+ slot->tts_ops->materialize(slot);
return heap_tuple_from_minimal_tuple(mslot->mintuple);
}
@@ -589,7 +589,7 @@ tts_minimal_copy_minimal_tuple(TupleTableSlot *slot)
MinimalTupleTableSlot *mslot = (MinimalTupleTableSlot *) slot;
if (!mslot->mintuple)
- tts_minimal_materialize(slot);
+ slot->tts_ops->materialize(slot);
return heap_copy_minimal_tuple(mslot->mintuple);
}
@@ -599,7 +599,7 @@ tts_minimal_store_tuple(TupleTableSlot *slot, MinimalTuple mtup, bool shouldFree
{
MinimalTupleTableSlot *mslot = (MinimalTupleTableSlot *) slot;
- tts_minimal_clear(slot);
+ slot->tts_ops->clear(slot);
Assert(!TTS_SHOULDFREE(slot));
Assert(TTS_EMPTY(slot));
@@ -789,7 +789,7 @@ tts_buffer_heap_get_heap_tuple(TupleTableSlot *slot)
Assert(!TTS_EMPTY(slot));
if (!bslot->base.tuple)
- tts_buffer_heap_materialize(slot);
+ slot->tts_ops->materialize(slot);
return bslot->base.tuple;
}
@@ -802,7 +802,7 @@ tts_buffer_heap_copy_heap_tuple(TupleTableSlot *slot)
Assert(!TTS_EMPTY(slot));
if (!bslot->base.tuple)
- tts_buffer_heap_materialize(slot);
+ slot->tts_ops->materialize(slot);
return heap_copytuple(bslot->base.tuple);
}
@@ -815,7 +815,7 @@ tts_buffer_heap_copy_minimal_tuple(TupleTableSlot *slot)
Assert(!TTS_EMPTY(slot));
if (!bslot->base.tuple)
- tts_buffer_heap_materialize(slot);
+ slot->tts_ops->materialize(slot);
return minimal_tuple_from_heap_tuple(bslot->base.tuple);
}