pgsql: Minor code review for tuple slot rewrite.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Minor code review for tuple slot rewrite.
Date: 2019-11-06 17:00:25
Message-ID: E1iSOfR-0007TI-Le@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9dbc6d25a97d11475fde36c4f71359371bbe240b

Modified Files
--------------
src/backend/executor/execTuples.c | 81 +++++++++++++++++++++------------------
src/include/executor/tuptable.h | 5 +--
2 files changed, 45 insertions(+), 41 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2019-11-06 18:11:48 pgsql: Document log_transaction_sample_rate as superuser-only
Previous Message Tom Lane 2019-11-06 16:12:00 pgsql: Sync our DTrace infrastructure with c.h's definition of type boo