Give WARNING if object is local, ERROR out if it is distributed

onder_view
Burak Velioglu 2022-04-20 17:53:33 +03:00
parent 81ea6c308c
commit 50201f4bec
2 changed files with 28 additions and 8 deletions

View File

@ -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);

View File

@ -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);