Fix omission of OCLASS_TRANSFORM in object_classes[]

This was forgotten in cac76582053e (and its fixup ad89a5d115).  Since it
seems way too easy to miss this, this commit also introduces a mechanism
to enforce that the array is consistent with the enum.

Problem reported independently by Robert Haas and Jaimin Pan.
Patches proposed by Jaimin Pan, Jim Nasby, Michael Paquier and myself,
though I didn't use any of these and instead went with a cleaner
approach suggested by Tom Lane.

Backpatch to 9.5.

Discussion:
https://www.postgresql.org/message-id/CA+Tgmoa6SgDaxW_n_7SEhwBAc=mniYga+obUj5fmw4rU9_mLvA@mail.gmail.com
https://www.postgresql.org/message-id/29788.1437411581@sss.pgh.pa.us
This commit is contained in:
Alvaro Herrera
2015-07-21 13:20:53 +02:00
parent e015c3e51f
commit d6ec181cf1
3 changed files with 13 additions and 14 deletions

View File

@ -112,7 +112,7 @@ typedef struct ObjectAddresses ObjectAddresses;
/*
* This enum covers all system catalogs whose OIDs can appear in
* pg_depend.classId or pg_shdepend.classId.
* pg_depend.classId or pg_shdepend.classId. Keep object_classes[] in sync.
*/
typedef enum ObjectClass
{
@ -148,10 +148,11 @@ typedef enum ObjectClass
OCLASS_EXTENSION, /* pg_extension */
OCLASS_EVENT_TRIGGER, /* pg_event_trigger */
OCLASS_POLICY, /* pg_policy */
OCLASS_TRANSFORM, /* pg_transform */
MAX_OCLASS /* MUST BE LAST */
OCLASS_TRANSFORM /* pg_transform */
} ObjectClass;
#define LAST_OCLASS OCLASS_TRANSFORM
/* in dependency.c */