30 #include "utils/fmgroids.h" 85 Anum_pg_inherits_inhparent,
95 if (numoids >= maxoids)
100 oidarr[numoids++] = inhrelid;
119 for (i = 0; i < numoids; i++)
121 inhrelid = oidarr[
i];
178 seen_rels =
hash_create(
"find_all_inheritors temporary table",
195 foreach(l, rels_list)
198 List *currentchildren;
211 foreach(lc, currentchildren)
238 *numparents = rel_numparents;
272 elog(
ERROR,
"cache lookup failed for relation %u", relationId);
350 foreach(queue_item, queue)
374 Anum_pg_inherits_inhrelid,
384 Oid inhparent = inh->inhparent;
387 if (inhparent == superclassRelid)
419 bool nulls[Natts_pg_inherits];
430 values[Anum_pg_inherits_inhseqno - 1] =
Int32GetDatum(seqNumber);
432 memset(nulls, 0,
sizeof(nulls));
466 Anum_pg_inherits_inhrelid,
470 true, NULL, 1, &key);
478 if (!
OidIsValid(inhparent) || parent == inhparent)
void hash_destroy(HTAB *hashp)
void table_close(Relation relation, LOCKMODE lockmode)
void systable_endscan(SysScanDesc sysscan)
Oid typeOrDomainTypeRelid(Oid type_id)
static ListCell * list_nth_cell(const List *list, int n)
#define RelationGetDescr(relation)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
#define InheritsRelidSeqnoIndexId
bool DeleteInheritsTuple(Oid inhrelid, Oid inhparent)
Oid typeidTypeRelid(Oid type_id)
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
void heap_freetuple(HeapTuple htup)
List * lappend_oid(List *list, Oid datum)
#define OidIsValid(objectId)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
HeapTuple systable_getnext(SysScanDesc sysscan)
#define SearchSysCacheExists1(cacheId, key1)
void pfree(void *pointer)
bool has_subclass(Oid relationId)
#define ObjectIdGetDatum(X)
bool has_superclass(Oid relationId)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
MemoryContext CurrentMemoryContext
#define list_make1_int(x1)
void StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
#define InheritsParentIndexId
List * lappend_int(List *list, int datum)
struct SeenRelsEntry SeenRelsEntry
HeapTuple SearchSysCache1(int cacheId, Datum key1)
void ReleaseSysCache(HeapTuple tuple)
#define list_make1_oid(x1)
List * find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
bool list_member_oid(const List *list, Oid datum)
#define HeapTupleIsValid(tuple)
bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
int oid_cmp(const void *p1, const void *p2)
FormData_pg_inherits * Form_pg_inherits
static int list_length(const List *l)
void * repalloc(void *pointer, Size size)
static Datum values[MAXATTR]
FormData_pg_class * Form_pg_class
List * find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, List **numparents)
void list_free(List *list)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define qsort(a, b, c, d)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
#define BTEqualStrategyNumber