Add sanity asserts for index OID and attnums during cache init
authorMichael Paquier <michael@paquier.xyz>
Thu, 27 Jul 2023 01:55:16 +0000 (10:55 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 27 Jul 2023 01:55:16 +0000 (10:55 +0900)
commitf6a84546b1a0ae43c00a7f351bc45fbde342466a
tree019a2ed9e05b1ef3ac233a376177d4e033613beb
parent31de7e60da34761365f94dc76cc2c1bf2172d1bc
Add sanity asserts for index OID and attnums during cache init

There was already a check on the relation OID, but not its index OID and
the attributes that can be used during the syscache lookups.  The two
assertions added by this commit are cheap, and actually useful for
developers to fasten the detection of incorrect data in a new entry
added in the syscache list, as these assertions are triggered during the
initial cache loading (initdb, or just backend startup), not requiring a
syscache that uses the new entry.

While on it, the relation OID check is switched to use OidIsValid().

Author: Aleksander Alekseev
Reviewed-by: Dagfinn Ilmari Mannsåker, Zhang Mingli, Michael Paquier
Discussion: https://postgr.es/m/CAJ7c6TOjUTJ0jxvWY6oJeP2-840OF8ch7qscZQsuVuotXTOS_g@mail.gmail.com
src/backend/utils/cache/catcache.c
src/backend/utils/cache/syscache.c