Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 902ecd3

Browse files
committed
Fix outdated comments regarding TupleTableSlots
The tts_flag is named TTS_FLAG_SHOULDFREE, so use that instead of TTS_SHOULDFREE, which is the name of the macro that checks for that flag. Additionally, 4da597e got rid of the TupleTableSlot.tts_tuple field but forgot to update a comment which referenced that field. Fix that. Reported-by: Zhen Mingyang <zhenmingyang@yeah.net> Reported-by: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/1a96696c.9d3.187193989c3.Coremail.zhenmingyang@yeah.net
1 parent 7f5b198 commit 902ecd3

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/backend/executor/execTuples.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ tts_heap_materialize(TupleTableSlot *slot)
385385
{
386386
/*
387387
* The tuple contained in this slot is not allocated in the memory
388-
* context of the given slot (else it would have TTS_SHOULDFREE set).
389-
* Copy the tuple into the given slot's memory context.
388+
* context of the given slot (else it would have TTS_FLAG_SHOULDFREE
389+
* set). Copy the tuple into the given slot's memory context.
390390
*/
391391
hslot->tuple = heap_copytuple(hslot->tuple);
392392
}
@@ -554,8 +554,9 @@ tts_minimal_materialize(TupleTableSlot *slot)
554554
{
555555
/*
556556
* The minimal tuple contained in this slot is not allocated in the
557-
* memory context of the given slot (else it would have TTS_SHOULDFREE
558-
* set). Copy the minimal tuple into the given slot's memory context.
557+
* memory context of the given slot (else it would have
558+
* TTS_FLAG_SHOULDFREE set). Copy the minimal tuple into the given
559+
* slot's memory context.
559560
*/
560561
mslot->mintuple = heap_copy_minimal_tuple(mslot->mintuple);
561562
}

src/include/executor/tuptable.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
* A TupleTableSlot can also be "empty", indicated by flag TTS_FLAG_EMPTY set
6969
* in tts_flags, holding no valid data. This is the only valid state for a
7070
* freshly-created slot that has not yet had a tuple descriptor assigned to
71-
* it. In this state, TTS_SHOULDFREE should not be set in tts_flags, tts_tuple
72-
* must be NULL and tts_nvalid zero.
71+
* it. In this state, TTS_FLAG_SHOULDFREE should not be set in tts_flags and
72+
* tts_nvalid should be set to zero.
7373
*
7474
* The tupleDescriptor is simply referenced, not copied, by the TupleTableSlot
7575
* code. The caller of ExecSetSlotDescriptor() is responsible for providing
@@ -79,8 +79,8 @@
7979
* mechanism to do more. However, the slot will increment the tupdesc
8080
* reference count if a reference-counted tupdesc is supplied.)
8181
*
82-
* When TTS_SHOULDFREE is set in tts_flags, the physical tuple is "owned" by
83-
* the slot and should be freed when the slot's reference to the tuple is
82+
* When TTS_FLAG_SHOULDFREE is set in tts_flags, the physical tuple is "owned"
83+
* by the slot and should be freed when the slot's reference to the tuple is
8484
* dropped.
8585
*
8686
* tts_values/tts_isnull are allocated either when the slot is created (when
@@ -268,7 +268,7 @@ typedef struct BufferHeapTupleTableSlot
268268
* If buffer is not InvalidBuffer, then the slot is holding a pin on the
269269
* indicated buffer page; drop the pin when we release the slot's
270270
* reference to that buffer. (TTS_FLAG_SHOULDFREE should not be set in
271-
* such a case, since presumably tts_tuple is pointing into the buffer.)
271+
* such a case, since presumably base.tuple is pointing into the buffer.)
272272
*/
273273
Buffer buffer; /* tuple's buffer, or InvalidBuffer */
274274
} BufferHeapTupleTableSlot;

0 commit comments

Comments
 (0)