pgsql: Add concept of invalid value to SysCacheIdentifier

Started by Michael Paquier5 months ago1 messagescomitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

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: /messages/by-id/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(-)