* This constant table maps ObjectClasses to the corresponding catalog OIDs.
* See also getObjectClass().
*/
-static const Oid object_classes[MAX_OCLASS] = {
+static const Oid object_classes[] = {
RelationRelationId, /* OCLASS_CLASS */
ProcedureRelationId, /* OCLASS_PROC */
TypeRelationId, /* OCLASS_TYPE */
DefaultAclRelationId, /* OCLASS_DEFACL */
ExtensionRelationId, /* OCLASS_EXTENSION */
EventTriggerRelationId, /* OCLASS_EVENT_TRIGGER */
- PolicyRelationId /* OCLASS_POLICY */
+ PolicyRelationId, /* OCLASS_POLICY */
+ TransformRelationId /* OCLASS_TRANSFORM */
};
{
ObjectAddress *item;
+ /*
+ * Make sure object_classes is kept up to date with the ObjectClass enum.
+ */
+ StaticAssertStmt(lengthof(object_classes) == LAST_OCLASS + 1,
+ "object_classes[] must cover all ObjectClasses");
+
/* enlarge array if needed */
if (addrs->numrefs >= addrs->maxrefs)
{
/*
* 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
{
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 */