Add concept of invalid value to SysCacheIdentifier

Michael Paquier <michael@paquier.xyz>

Commit: c06b5b99bbb0d0e5ddeea9661ec7678e3cf53b4c
Author: Michael Paquier <michael@paquier.xyz>
Date: 2026-02-18T00:25:52Z
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@proxel.se>
Discussion: https://postgr.es/m/aZQRnmp9nVjtxAHS@paquier.xyz

Files

PathChange+/−
src/backend/catalog/aclchk.c modified +1 −1
src/backend/catalog/genbki.pl modified +9 −2
src/backend/catalog/objectaddress.c modified +31 −31

Discussion