diff --git a/src/backend/distributed/commands/view.c b/src/backend/distributed/commands/view.c index 975c8cdbc..e57681656 100644 --- a/src/backend/distributed/commands/view.c +++ b/src/backend/distributed/commands/view.c @@ -93,6 +93,11 @@ PostprocessViewStmt(Node *node, const char *queryString) return NIL; } + if (!HasAnyNodes()) + { + return NIL; + } + ObjectAddress viewAddress = GetObjectAddressFromParseTree((Node *) stmt, false); if (IsObjectAddressOwnedByExtension(&viewAddress, NULL)) @@ -105,12 +110,15 @@ PostprocessViewStmt(Node *node, const char *queryString) if (errMsg != NULL) { - if (HasAnyNodes()) + if (IsObjectDistributed(&viewAddress)) + { + RaiseDeferredError(errMsg, ERROR); + } + else { RaiseDeferredError(errMsg, WARNING); + return NIL; } - - return NIL; } EnsureDependenciesExistOnAllNodes(&viewAddress); diff --git a/src/backend/distributed/metadata/dependency.c b/src/backend/distributed/metadata/dependency.c index 0b4cfcd00..bd5a379ad 100644 --- a/src/backend/distributed/metadata/dependency.c +++ b/src/backend/distributed/metadata/dependency.c @@ -803,8 +803,11 @@ DeferErrorIfHasUnsupportedDependency(const ObjectAddress *objectAddress) * Otherwise, callers are expected to throw the error returned from this * function as a hard one by ignoring the detail part. */ - appendStringInfo(detailInfo, "\"%s\" will be created only locally", - objectDescription); + if (!IsObjectDistributed(objectAddress)) + { + appendStringInfo(detailInfo, "\"%s\" will be created only locally", + objectDescription); + } if (SupportedDependencyByCitus(undistributableDependency)) { @@ -815,9 +818,18 @@ DeferErrorIfHasUnsupportedDependency(const ObjectAddress *objectAddress) objectDescription, dependencyDescription); - appendStringInfo(hintInfo, "Distribute \"%s\" first to distribute \"%s\"", - dependencyDescription, - objectDescription); + if (IsObjectDistributed(objectAddress)) + { + appendStringInfo(hintInfo, "Distribute \"%s\" first to update \"%s\" on worker nodes", + dependencyDescription, + objectDescription); + } + else + { + appendStringInfo(hintInfo, "Distribute \"%s\" first to distribute \"%s\"", + dependencyDescription, + objectDescription); + } return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED, errorInfo->data, detailInfo->data, hintInfo->data);