/* * Returns if relation represented by oid and Form_pg_class entry * is publishable. * * Does same checks as the above, but does not need relation to be opened * and also does not throw errors. * * Note this also excludes all tables with relid < FirstNormalObjectId, * ie all tables created during initdb. This mainly affects the preinstalled * information_schema. (IsCatalogClass() only checks for these inside * pg_catalog and toast schemas.) */ static bool is_publishable_class(Oid relid, Form_pg_class reltuple) { return reltuple->relkind == RELKIND_RELATION && !IsCatalogClass(relid, reltuple) && reltuple->relpersistence == RELPERSISTENCE_PERMANENT && relid >= FirstNormalObjectId; }
/* * IsCatalogRelation * True iff the relation is a system catalog, or the toast table for * a system catalog. By a system catalog, we mean one that created * in the pg_catalog schema during initdb. As with IsSystemRelation(), * user-created relations in pg_catalog don't count as system catalogs. * * Note that IsSystemRelation() returns true for ALL toast relations, * but this function returns true only for toast relations of system * catalogs. */ bool IsCatalogRelation(Relation relation) { return IsCatalogClass(RelationGetRelid(relation), relation->rd_rel); }
/* * IsSystemClass * Like the above, but takes a Form_pg_class as argument. * Used when we do not want to open the relation and have to * search pg_class directly. */ bool IsSystemClass(Oid relid, Form_pg_class reltuple) { return IsToastClass(reltuple) || IsCatalogClass(relid, reltuple); }