From: Tristan Partin <tristan@partin.io>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Japin Li <japinli@hotmail.com>
Subject: Re: Add counted_by attribute
Date: Tue, 06 Oct 2026 20:41:12 +0000
Message-ID: <DLY1OPBXGI77.UTU2G1WQ0IN1@partin.io> (raw)
In-Reply-To: <175d0156-cacf-454a-a874-fb9014249b31@eisentraut.org>
References: <DKBEBF32QLUA.3L2DJRPUYNKHZ@partin.io>
<c708fc95-09f5-417e-8a98-30a7dd4c8683@eisentraut.org>
<DLMINDI5ZMC5.Q67A4K24KPGU@partin.io>
<SY7PR01MB1092141E18C74E8A8E1400F2FB6822@SY7PR01MB10921.ausprd01.prod.outlook.com>
<DLNOJYTANPY0.1RZ6S0LNK3W2D@partin.io>
<SY7PR01MB109214843BAC7F3E996679F67B6802@SY7PR01MB10921.ausprd01.prod.outlook.com>
<DLRIGIRGKHJY.PCHK8ZIDV5KM@partin.io>
<175d0156-cacf-454a-a874-fb9014249b31@eisentraut.org>
On Mon Oct 5, 2026 at 7:52 PM UTC, Peter Eisentraut wrote:
> Ok, all the infrastructure is in place now. I'm working through the
> attribute additions now.
>
> One thing to think about is that adding these attributes to server
> header files would also affect extensions. I think we might want to do
> some research about that. Like, is the normal API to fill in the
> structure yourself, or are there wrapper functions that are mandatory to
> use? I'm going to park that for the moment and work through the
> attribute additions in .c files first.
I have to think that extensions testing with
-fsanitize=bounds/_FORTIFY_SOURCE=3 is pretty rare. In any case, I did
some analysis (grepping and reading) on the list of structs exposed in
header files against 9 popular extensions (not in contrib), and I didn't
find any potential issues.
List of extensions that I looked at:
- PostGIS
- Citus
- TimescaleDB
- pgvector
- pg_cron
- pg_hint_plan
- pgaudit
- pg_repack
- pglogical
It seems like core does a good job of providing helper functions/macros
for creating objects of variable size, and downstream extensions do
a good job of making use of them.
If you have ideas that you would like me to try to help make you more
confident in committing, let me know.
Attached is a list of structs, in header files, that I added the
counted_by attribute to.
--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)
Attachments:counted_by_header_structs.csv (text/csv, 1.7K) download
header,struct,array_member,count_field
access/brin_internal.h,BrinOpcInfo,oi_typcache,oi_nstored
access/tupdesc.h,TupleDescData,compact_attrs,natts
executor/execPartition.h,PartitionPruneState,partprunedata,num_partprunedata
executor/execPartition.h,PartitionPruningData,partrelprunedata,num_partrelprunedata
executor/instrument.h,WorkerNodeInstrumentation,instrument,num_workers
executor/instrument_node.h,SharedAggInfo,sinstrument,num_workers
executor/instrument_node.h,SharedBitmapHeapInstrumentation,sinstrument,num_workers
executor/instrument_node.h,SharedHashInfo,hinstrument,num_workers
executor/instrument_node.h,SharedIncrementalSortInfo,sinfo,num_workers
executor/instrument_node.h,SharedIndexScanInstrumentation,winstrument,num_workers
executor/instrument_node.h,SharedMemoizeInfo,sinstrument,num_workers
executor/instrument_node.h,SharedSeqScanInstrumentation,sinstrument,num_workers
executor/instrument_node.h,SharedSortInfo,sinstrument,num_workers
executor/instrument_node.h,SharedTidRangeScanInstrumentation,sinstrument,num_workers
fe_utils/parallel_slot.h,ParallelSlotArray,slots,numslots
jit/jit.h,SharedJitInstrumentation,jit_instr,num_workers
nodes/bitmapset.h,Bitmapset,words,nwords
regex/regguts.h,struct arcbatch,a,narcs
regex/regguts.h,struct statebatch,s,nstates
statistics/extended_stats_internal.h,MultiSortSupportData,ssup,ndims
statistics/statistics.h,MCVList,items,nitems
statistics/statistics.h,MVDependencies,deps,ndeps
statistics/statistics.h,MVDependency,attributes,nattributes
statistics/statistics.h,MVNDistinct,items,nitems
tsearch/dicts/spell.h,SPNode,data,length
utils/catcache.h,CatCList,members,n_members
utils/datetime.h,TimeZoneAbbrevTable,abbrevs,numabbrevs
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-hackers@postgresql.org
Cc: tristan@partin.io, peter@eisentraut.org, japinli@hotmail.com
Subject: Re: Add counted_by attribute
In-Reply-To: <DLY1OPBXGI77.UTU2G1WQ0IN1@partin.io>
* 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