To show object description check

velioglu/cyclic_dep_with_tho
Burak Velioglu 2022-03-07 16:52:46 +03:00
parent eca6542023
commit 752419ff14
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
2 changed files with 22 additions and 1 deletions

View File

@ -669,7 +669,22 @@ ProcessUtilityInternal(PlannedStmt *pstmt,
if (ops && ops->address) if (ops && ops->address)
{ {
ObjectAddress targetObject = GetObjectAddressFromParseTree(parsetree, true); ObjectAddress targetObject = GetObjectAddressFromParseTree(parsetree, true);
ErrorIfCircularDependencyExists(&targetObject); char *objectDescription = NULL;
#if PG_VERSION_NUM >= PG_VERSION_14
objectDescription = getObjectDescription(&targetObject, true);
#else
objectDescription = getObjectDescription(&targetObject);
#endif
/*
* Having object description as NULL means the target object is either dropped
* or it's name has been changed
*/
if (objectDescription != NULL)
{
ErrorIfCircularDependencyExists(&targetObject);
}
} }
if (ops && ops->postprocess) if (ops && ops->postprocess)

View File

@ -385,6 +385,12 @@ RecurseObjectDependencies(ObjectAddress target, expandFn expand, followFn follow
void void
ErrorIfCircularDependencyExists(const ObjectAddress *objectAddress) ErrorIfCircularDependencyExists(const ObjectAddress *objectAddress)
{ {
/*
* We need to get the see dependencies created in this command.
*/
CommandCounterIncrement();
List *dependencies = GetAllSupportedDependenciesForObject(objectAddress); List *dependencies = GetAllSupportedDependenciesForObject(objectAddress);
ObjectAddress *dependency = NULL; ObjectAddress *dependency = NULL;