pgsql: Thread flags through begin-scan APIs

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Thread flags through begin-scan APIs
Date: 2026-03-30 16:29:21
Message-ID: E1w7FUO-002AtW-0i@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Thread flags through begin-scan APIs

Add an AM user-settable flags parameter to several of the table scan
functions, one table AM callback, and index_beginscan(). This allows
users to pass additional context to be used when building the scan
descriptors.

For index scans, a new flags field is added to IndexFetchTableData, and
the heap AM saves the caller-provided flags there.

This introduces an extension point for follow-up work to pass per-scan
information (such as whether the relation is read-only for the current
query) from the executor to the AM layer.

Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Tomas Vondra <tomas(at)vondra(dot)me>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/2be31f17-5405-4de9-8d73-90ebc322f7d8%40vondra.me

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dcd8cc1c852cac4e65d336a79afb6b9eb9700ae1

Modified Files
--------------
contrib/pgrowlocks/pgrowlocks.c | 2 +-
src/backend/access/brin/brin.c | 3 +-
src/backend/access/gin/gininsert.c | 3 +-
src/backend/access/heap/heapam_handler.c | 9 ++-
src/backend/access/index/genam.c | 6 +-
src/backend/access/index/indexam.c | 13 ++--
src/backend/access/nbtree/nbtsort.c | 3 +-
src/backend/access/table/tableam.c | 22 ++++---
src/backend/commands/constraint.c | 3 +-
src/backend/commands/copyto.c | 3 +-
src/backend/commands/tablecmds.c | 13 ++--
src/backend/commands/typecmds.c | 6 +-
src/backend/executor/execIndexing.c | 4 +-
src/backend/executor/execReplication.c | 12 ++--
src/backend/executor/nodeBitmapHeapscan.c | 3 +-
src/backend/executor/nodeIndexonlyscan.c | 9 ++-
src/backend/executor/nodeIndexscan.c | 12 ++--
src/backend/executor/nodeSamplescan.c | 3 +-
src/backend/executor/nodeSeqscan.c | 9 ++-
src/backend/executor/nodeTidrangescan.c | 7 +-
src/backend/partitioning/partbounds.c | 3 +-
src/backend/utils/adt/selfuncs.c | 3 +-
src/include/access/genam.h | 6 +-
src/include/access/heapam.h | 5 +-
src/include/access/relscan.h | 6 ++
src/include/access/tableam.h | 103 ++++++++++++++++++++++--------
26 files changed, 185 insertions(+), 86 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-03-30 17:10:04 pgsql: Don't use bits32 in table AM interface
Previous Message Tom Lane 2026-03-30 16:02:36 pgsql: Detect pfree or repalloc of a previously-freed memory chunk.