pgsql: Ensure we allocate NAMEDATALEN bytes for names in Index Only Sca

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Ensure we allocate NAMEDATALEN bytes for names in Index Only Sca
Date: 2024-05-01 01:23:19
Message-ID: E1s1ygo-000sU9-LG@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Ensure we allocate NAMEDATALEN bytes for names in Index Only Scans

As an optimization, we store "name" columns as cstrings in btree
indexes.

Here we modify it so that Index Only Scans convert these cstrings back
to names with NAMEDATALEN bytes rather than storing the cstring in the
tuple slot, as was happening previously.

Bug: #17855
Reported-by: Alexander Lakhin
Reviewed-by: Alexander Lakhin, Tom Lane
Discussion: https://postgr.es/m/17855-5f523e0f9769a566@postgresql.org
Backpatch-through: 12, all supported versions

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a34bcd0c23e7f67daad7b026320a12c52d797ac

Modified Files
--------------
src/backend/executor/nodeIndexonlyscan.c | 95 +++++++++++++++++++++++++--
src/include/catalog/pg_opclass.dat | 7 +-
src/include/nodes/execnodes.h | 4 ++
src/test/regress/expected/index_including.out | 25 +++++++
src/test/regress/sql/index_including.sql | 19 ++++++
5 files changed, 141 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2024-05-01 01:23:43 pgsql: Ensure we allocate NAMEDATALEN bytes for names in Index Only Sca
Previous Message David Rowley 2024-05-01 01:22:58 pgsql: Ensure we allocate NAMEDATALEN bytes for names in Index Only Sca