pgsql: Disallow serialized callbacks for fixed-sized custom stats kinds

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Disallow serialized callbacks for fixed-sized custom stats kinds
Date: 2026-10-14 23:47:24
Message-ID: E1xH8gu-00000001et8-2u90@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Disallow serialized callbacks for fixed-sized custom stats kinds

The pgstats callbacks to_serialized_name() and from_serialized_name()
are documented as being for variable-sized stats only, as they map an
entry hash key to a name written to the on-disk stats file.

pgstat_register_kind() did not enforce this policy for custom stats
kinds. Enforcing this behavior is more interesting since 44539786b829,
where a stats kind can begin pointing at its own hash table, offering as
guarantee that a PGSTAT_FILE_ENTRY_NAME will never match a fixed-sized
stats kind at startup, should the same kind ID be reused across restart
with a different kind info.

See also 0d110901f0ef that has dealt with a similar issue, for
PGSTAT_FILE_ENTRY_HASH.

Author: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAN4CZFMxuOOuYV14+i3YcPG-16q02eBtSVa82J111=ZnDwSicA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c6665bf0266a7ae78117c3ed0299bfbd1f1331a

Modified Files
--------------
src/backend/utils/activity/pgstat.c | 4 ++++
1 file changed, 4 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-10-15 02:49:33 pgsql: Fix EPQ run-time pruning using the parent's PARAM_EXEC values
Previous Message Michael Paquier 2026-10-14 23:26:50 pgsql: Fix crash when reading stats file at startup with fixed-sized ki