pgsql: Add concept of invalid value to SysCacheIdentifier

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add concept of invalid value to SysCacheIdentifier
Date: 2026-02-18 00:26:35
Message-ID: E1vsVOk-001ML8-2q@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add concept of invalid value to SysCacheIdentifier

This commit tweaks the generation of the syscache IDs for the enum
SysCacheIdentifier to now include an invalid value, with -1 assigned as
value. The concept of an invalid syscache ID exists when handling
lookups of a ObjectAddress, based on their set of properties in
ObjectPropertyType. -1 is used for the case where an object type has no
option for a syscache lookup.

This has been found as independently useful while discussing a switch of
SysCacheIdentifier to a typedef, as we already have places that want to
know about the concept of an invalid value when dealing with
ObjectAddresses.

Reviewed-by: Andreas Karlsson <andreas(at)proxel(dot)se>
Discussion: https://postgr.es/m/aZQRnmp9nVjtxAHS@paquier.xyz

Branch
------
master

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

Modified Files
--------------
src/backend/catalog/aclchk.c | 2 +-
src/backend/catalog/genbki.pl | 11 +++++--
src/backend/catalog/objectaddress.c | 62 ++++++++++++++++++-------------------
3 files changed, 41 insertions(+), 34 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-02-18 00:59:56 pgsql: Switch SysCacheIdentifier to a typedef enum
Previous Message Michael Paquier 2026-02-17 23:48:42 pgsql: Fix one-off issue with cache ID in objectaddress.c