85#include "utils/fmgroids.h"
102#define DEPFLAG_ORIGINAL 0x0001
103#define DEPFLAG_NORMAL 0x0002
104#define DEPFLAG_AUTO 0x0004
105#define DEPFLAG_INTERNAL 0x0008
106#define DEPFLAG_PARTITION 0x0010
107#define DEPFLAG_EXTENSION 0x0020
108#define DEPFLAG_REVERSE 0x0040
109#define DEPFLAG_IS_PART 0x0080
110#define DEPFLAG_SUBOBJECT 0x0100
200 bool original =
false;
548 errmsg(
"cannot drop %s because it is required by the database system",
773 elog(
ERROR,
"deletion of owning object %s failed to delete %s",
815 elog(
ERROR,
"unrecognized dependency type '%c' for %s",
840 errmsg(
"cannot drop %s because %s requires it",
905 errmsg(
"cannot drop %s because %s depends on it",
953 elog(
ERROR,
"unrecognized dependency type '%c' for %s",
1077 errmsg(
"cannot drop %s because %s requires it",
1097#define MAX_REPORTED_DEPS 100
1165 if (logdetail.
len != 0)
1189 if (logdetail.
len != 0)
1200 "(see server log for list)",
1201 "\nand %d other objects "
1202 "(see server log for list)",
1211 errmsg(
"cannot drop %s because other objects depend on it",
1215 errhint(
"Use DROP ... CASCADE to drop the dependent objects too.")));
1219 errmsg(
"cannot drop desired object(s) because other objects depend on them"),
1222 errhint(
"Use DROP ... CASCADE to drop the dependent objects too.")));
1228 "drop cascades to %d other objects",
1267 elog(
ERROR,
"cache lookup failed for %s %u",
1290 elog(
ERROR,
"could not find tuple for %s %u",
1539 elog(
ERROR,
"global objects cannot be deleted by doDeletion");
1662 context.
addrs = addrs;
1872 if (!con->constisnull)
1943 errmsg(
"constant of the type %s cannot be used here",
1954 errmsg(
"constant of the type %s cannot be used here",
2040 if (sbsref->refrestype != sbsref->refcontainertype &&
2041 sbsref->refrestype != sbsref->refelemtype)
2049 elog(
ERROR,
"already-planned subqueries not supported");
2088 foreach(l, fstore->fieldnums)
2163 foreach(l,
rcexpr->opnos)
2168 foreach(l,
rcexpr->opfamilies)
2267 switch (
rte->rtekind)
2289 for (
int i = 0;
i <
rte->joinmergedcols;
i++)
2309 errmsg(
"transition table \"%s\" cannot be referenced in a persistent object",
2310 rte->eref->aliasname)));
2330 if (query->resultRelation <= 0 ||
2332 elog(
ERROR,
"invalid resultRelation %d",
2333 query->resultRelation);
2352 foreach(
lc, query->constraintDeps)
2386 foreach(
ct, rtfunc->funccoltypes)
2391 foreach(
ct, rtfunc->funccolcollations)
2408 foreach(
ct, tf->coltypes)
2413 foreach(
ct, tf->colcollations)
2452 foreach(
lc,
rte->functions)
2462 if (rtfunc->funccolnames !=
NIL)
2494 errmsg(
"column %d of relation \"%s\" does not exist",
2641 if (
obja->objectId >
objb->objectId)
2643 if (
obja->objectId <
objb->objectId)
2662 if ((
unsigned int)
obja->objectSubId < (
unsigned int)
objb->objectSubId)
2664 if ((
unsigned int)
obja->objectSubId > (
unsigned int)
objb->objectSubId)
2810 bool result =
false;
2827 else if (
thisobj->objectSubId == 0)
2883 bool result =
false;
2898 else if (
thisobj->objectSubId == 0)
#define InvalidAttrNumber
#define ngettext(s, p, n)
#define Assert(condition)
#define OidIsValid(objectId)
bool IsPinnedObject(Oid classId, Oid objectId)
bool IsSharedRelation(Oid relationId)
void DeleteSequenceTuple(Oid relid)
static bool object_address_present_add_flags(const ObjectAddress *object, int flags, ObjectAddresses *addrs)
#define DEPFLAG_PARTITION
void performMultipleDeletions(const ObjectAddresses *objects, DropBehavior behavior, int flags)
static void add_exact_object_address_extra(const ObjectAddress *object, const ObjectAddressExtra *extra, ObjectAddresses *addrs)
void record_object_address_dependencies(const ObjectAddress *depender, ObjectAddresses *referenced, DependencyType behavior)
static void DropObjectById(const ObjectAddress *object)
static int object_address_comparator(const void *a, const void *b)
void sort_object_addresses(ObjectAddresses *addrs)
static void doDeletion(const ObjectAddress *object, int flags)
static bool stack_address_present_add_flags(const ObjectAddress *object, int flags, ObjectAddressStack *stack)
void performDeletionCheck(const ObjectAddress *object, DropBehavior behavior, int flags)
static void add_object_address(Oid classId, Oid objectId, int32 subId, ObjectAddresses *addrs)
static bool find_expr_references_walker(Node *node, find_expr_references_context *context)
static void eliminate_duplicate_dependencies(ObjectAddresses *addrs)
void AcquireDeletionLock(const ObjectAddress *object, int flags)
void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags)
bool query_uses_temp_object(Query *query, ObjectAddress *temp_object)
static void deleteOneObject(const ObjectAddress *object, Relation *depRel, int32 flags)
static void DeleteInitPrivs(const ObjectAddress *object)
#define MAX_REPORTED_DEPS
static void process_function_rte_ref(RangeTblEntry *rte, AttrNumber attnum, find_expr_references_context *context)
static void reportDependentObjects(const ObjectAddresses *targetObjects, DropBehavior behavior, int flags, const ObjectAddress *origObject)
void ReleaseDeletionLock(const ObjectAddress *object)
void recordDependencyOnSingleRelExpr(const ObjectAddress *depender, Node *expr, Oid relId, DependencyType behavior, DependencyType self_behavior, bool reverse_self)
void recordDependencyOnExpr(const ObjectAddress *depender, Node *expr, List *rtable, DependencyType behavior)
static void findDependentObjects(const ObjectAddress *object, int objflags, int flags, ObjectAddressStack *stack, ObjectAddresses *targetObjects, const ObjectAddresses *pendingObjects, Relation *depRel)
void collectDependenciesOfExpr(ObjectAddresses *addrs, Node *expr, List *rtable)
bool object_address_present(const ObjectAddress *object, const ObjectAddresses *addrs)
bool find_temp_object(const ObjectAddresses *addrs, bool local_temp_okay, ObjectAddress *foundobj)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
ObjectAddresses * new_object_addresses(void)
#define DEPFLAG_SUBOBJECT
#define DEPFLAG_EXTENSION
static void deleteObjectsInList(ObjectAddresses *targetObjects, Relation *depRel, int flags)
void free_object_addresses(ObjectAddresses *addrs)
#define PERFORM_DELETION_CONCURRENTLY
#define PERFORM_DELETION_SKIP_EXTENSIONS
@ DEPENDENCY_AUTO_EXTENSION
@ DEPENDENCY_PARTITION_PRI
@ DEPENDENCY_PARTITION_SEC
#define PERFORM_DELETION_CONCURRENT_LOCK
#define PERFORM_DELETION_QUIETLY
#define PERFORM_DELETION_SKIP_ORIGINAL
#define PERFORM_DELETION_INTERNAL
bool message_level_is_interesting(int elevel)
int errcode(int sqlerrcode)
int int errdetail_internal(const char *fmt,...) pg_attribute_printf(1
int errhint(const char *fmt,...) pg_attribute_printf(1
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
int int int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
int int int errdetail_log(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
void EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool normal)
bool trackDroppedObjectsNeeded(void)
bool EventTriggerSupportsObject(const ObjectAddress *object)
Oid CurrentExtensionObject
void RemoveExtensionById(Oid extId)
#define palloc_object(type)
#define palloc_array(type, count)
TupleDesc get_expr_result_tupdesc(Node *expr, bool noError)
void RemoveFunctionById(Oid funcOid)
void systable_endscan(SysScanDesc sysscan)
bool systable_recheck_tuple(SysScanDesc sysscan, HeapTuple tup)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
void RemoveAttributeById(Oid relid, AttrNumber attnum)
void heap_drop_with_catalog(Oid relid)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode)
void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
List * list_delete_first(List *list)
List * lcons(void *datum, List *list)
void LockSharedObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
void UnlockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
#define AccessExclusiveLock
#define ShareUpdateExclusiveLock
char get_rel_relkind(Oid relid)
Oid get_typ_typrelid(Oid typid)
Oid getBaseType(Oid typid)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
bool isTempNamespace(Oid namespaceId)
bool isAnyTempNamespace(Oid namespaceId)
Oid exprType(const Node *expr)
#define query_tree_walker(q, w, c, f)
#define QTW_EXAMINE_SORTGROUP
#define expression_tree_walker(n, w, c)
#define QTW_IGNORE_JOINALIASES
#define IsA(nodeptr, _type_)
#define InvokeObjectDropHookArg(classId, objectId, subId, dropflags)
AttrNumber get_object_attnum_oid(Oid class_id)
const char * get_object_class_descr(Oid class_id)
char * getObjectDescription(const ObjectAddress *object, bool missing_ok)
Oid get_object_oid_index(Oid class_id)
SysCacheIdentifier get_object_catcache_oid(Oid class_id)
Oid get_object_namespace(const ObjectAddress *address)
void RemoveOperatorById(Oid operOid)
#define rt_fetch(rangetable_index, rangetable)
void RemoveAttrDefaultById(Oid attrdefId)
void RemoveConstraintById(Oid conId)
void recordMultipleDependencies(const ObjectAddress *depender, const ObjectAddress *referenced, int nreferenced, DependencyType behavior)
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
END_CATALOG_STRUCT typedef FormData_pg_depend * Form_pg_depend
void LargeObjectDrop(Oid loid)
static int list_length(const List *l)
static void * list_nth(const List *list, int n)
void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId, int32 objectSubId)
void RemovePolicyById(Oid policy_id)
#define qsort(a, b, c, d)
static Oid DatumGetObjectId(Datum X)
static Datum ObjectIdGetDatum(Oid X)
static Datum Int32GetDatum(int32 X)
void RemovePublicationSchemaById(Oid psoid)
void RemovePublicationById(Oid pubid)
void RemovePublicationRelById(Oid proid)
void RemoveRewriteRuleById(Oid ruleOid)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
void DeleteSecurityLabel(const ObjectAddress *object)
void check_stack_depth(void)
void RemoveStatisticsById(Oid statsOid)
#define BTEqualStrategyNumber
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
const ObjectAddress * object
struct ObjectAddressStack * next
ObjectAddressExtra * extras
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
#define SearchSysCacheExists1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void RemoveTriggerById(Oid trigOid)
void RemoveTSConfigurationById(Oid cfgId)
void RemoveTypeById(Oid typeOid)
void CommandCounterIncrement(void)