pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix new tuple deforming code so it can support cstrings again
Date: Fri, 20 Mar 2026 01:16:26 +0000
Message-ID: <E1w3OTR-000ZXQ-0R@gemulon.postgresql.org> (raw)

Fix new tuple deforming code so it can support cstrings again

In c456e3911, I mistakenly thought that the deformer code would never
see cstrings and that I could use pg_assume() to have the compiler omit
producing code for attlen == -2 attributes.  That saves bloating the
deforming code a bit with the extra check and strlen() call.  While this
is ok to do for tuples from the heap, it's not ok to do for
MinimalTuples as those *can* contain cstrings and
tts_minimal_getsomeattrs() implements deforming by inlining the
(slightly misleadingly named) slot_deform_heap_tuple() code.

To fix, add a new parameter to the slot_deform_heap_tuple() and have the
callers define which code to inline.  Because this new parameter is
passed as a const, the compiler can choose to emit or not emit the
cstring-related code based on the parameter's value.

Author: David Rowley <dgrowleyml@gmail.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAHewXNmSK+gKziAt_WvQoMVWt3_LRVMmRYY9dAbMPMcpPV0QmA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/07d5bffe75d05b9c84803ea1ffaf5ce729f0e717

Modified Files
--------------
src/backend/executor/execTuples.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)



Message-ID: <E1w3OTR-000ZXQ-0R@gemulon.postgresql.org>
Permalink:  ../E1w3OTR-000ZXQ-0R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w3OTR-000ZXQ-0R@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix new tuple deforming code so it can support cstrings again
  In-Reply-To: <E1w3OTR-000ZXQ-0R@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox