summaryrefslogtreecommitdiff
path: root/src/include/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-11-06 12:00:17 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-11-06 12:00:17 -0500
commit22e44e8dbcfe4b9f3c4189f07a2361c951d72514 (patch)
tree09c1cded46155126cc09dbefa2788d23ff004e10 /src/include/executor
parentff43b3e88eceb94b3a2b2579e8510e4f3aedbe09 (diff)
Minor code review for tuple slot rewrite.
Avoid creating transiently-inconsistent slot states where possible, by not setting TTS_FLAG_SHOULDFREE until after the slot actually has a free'able tuple pointer, and by making sure that we reset tts_nvalid and related derived state before we replace the tuple contents. This would only matter if something were to examine the slot after we'd suffered some kind of error (e.g. out of memory) while manipulating the slot. We typically don't do that, so these changes might just be cosmetic --- but even if so, it seems like good future-proofing. Also remove some redundant Asserts, and add a couple for consistency. Back-patch to v12 where all this code was rewritten. Discussion: https://postgr.es/m/16095-c3ff2e5283b8dba5@postgresql.org
Diffstat (limited to 'src/include/executor')
-rw-r--r--src/include/executor/tuptable.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h
index 885b481d9a4..b7f977233be 100644
--- a/src/include/executor/tuptable.h
+++ b/src/include/executor/tuptable.h
@@ -261,9 +261,8 @@ typedef struct BufferHeapTupleTableSlot
/*
* If buffer is not InvalidBuffer, then the slot is holding a pin on the
* indicated buffer page; drop the pin when we release the slot's
- * reference to that buffer. (TTS_FLAG_SHOULDFREE should not be set be
- * false in such a case, since presumably tts_tuple is pointing at the
- * buffer page.)
+ * reference to that buffer. (TTS_FLAG_SHOULDFREE should not be set in
+ * such a case, since presumably tts_tuple is pointing into the buffer.)
*/
Buffer buffer; /* tuple's buffer, or InvalidBuffer */
} BufferHeapTupleTableSlot;