diff options
Diffstat (limited to 'src/backend/catalog/pg_depend.c')
-rw-r--r-- | src/backend/catalog/pg_depend.c | 101 |
1 files changed, 1 insertions, 100 deletions
diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c index 0915ef5c827..95b258f93fd 100644 --- a/src/backend/catalog/pg_depend.c +++ b/src/backend/catalog/pg_depend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.18 2006/02/11 22:17:18 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.19 2006/02/12 19:11:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -361,102 +361,3 @@ isObjectPinned(const ObjectAddress *object, Relation rel) return ret; } - -List* getReferencingOids(Oid refClassId, Oid refObjId, Oid refObjSubId, - Oid classId, DependencyType deptype) -{ - ScanKeyData key[3]; - SysScanDesc scan; - HeapTuple tup; - Relation depRel; - List *list = NIL; - - depRel = heap_open(DependRelationId, AccessShareLock); - - ScanKeyInit(&key[0], - Anum_pg_depend_refclassid, - BTEqualStrategyNumber, F_OIDEQ, - ObjectIdGetDatum(refClassId)); - - ScanKeyInit(&key[1], - Anum_pg_depend_refobjid, - BTEqualStrategyNumber, F_OIDEQ, - ObjectIdGetDatum(refObjId)); - - ScanKeyInit(&key[2], - Anum_pg_depend_refobjsubid, - BTEqualStrategyNumber, F_OIDEQ, - ObjectIdGetDatum(refObjSubId)); - - scan = systable_beginscan(depRel, DependReferenceIndexId, true, - SnapshotNow, 3, key); - - while (HeapTupleIsValid(tup = systable_getnext(scan))) - { - Form_pg_depend depForm = (Form_pg_depend) GETSTRUCT(tup); - - /* check if the class id is what we want */ - if (depForm->classid != classId) - continue; - - /* check if the DependencyType is what we want */ - if (depForm->deptype != deptype) - continue; - - /* if we are still here, we have found a match */ - list = lcons_oid(depForm->objid, list); - break; - } - systable_endscan(scan); - - heap_close(depRel, AccessShareLock); - return list; -} - - -List* getDependentOids(Oid classId, Oid objId, - Oid refClassId, DependencyType deptype) -{ - ScanKeyData key[2]; - SysScanDesc scan; - HeapTuple tup; - Relation depRel; - List *list = NIL; - - depRel = heap_open(DependRelationId, AccessShareLock); - - ScanKeyInit(&key[0], - Anum_pg_depend_classid, - BTEqualStrategyNumber, F_OIDEQ, - ObjectIdGetDatum(classId)); - - ScanKeyInit(&key[1], - Anum_pg_depend_objid, - BTEqualStrategyNumber, F_OIDEQ, - ObjectIdGetDatum(objId)); - - scan = systable_beginscan(depRel, DependDependerIndexId, true, - SnapshotNow, 2, key); - - while (HeapTupleIsValid(tup = systable_getnext(scan))) - { - Form_pg_depend depForm = (Form_pg_depend) GETSTRUCT(tup); - - /* check if the DependencyType is what we want */ - if (depForm->deptype != deptype) - continue; - - /* check if the referenced class id is what we want */ - if (depForm->refclassid != refClassId) - continue; - - /* if we are still here, we have found a match */ - list = lcons_oid(depForm->refobjid, list); - break; - } - systable_endscan(scan); - - heap_close(depRel, AccessShareLock); - return list; -} - |