mirror of https://github.com/citusdata/citus.git
Introduces getObjectTypeDescription_compat and getObjectIdentity_compat macros
getObjectTypeDescription and getObjectIdentity functions now have a new bool missing_ok parameter These new macros give us the ability to use this new parameter for PG14 and they don't give the parameter for previous versions Currently all missing_ok parameters are set to false to keep current behavior Relevant PG commit: 2a10fdc4307a667883f7a3369cb93a721ade9680pull/5209/head
parent
f8d3e50f25
commit
54ee93885a
|
@ -251,7 +251,7 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
|
||||||
*/
|
*/
|
||||||
Assert(false);
|
Assert(false);
|
||||||
ereport(ERROR, (errmsg("unsupported object %s for distribution by citus",
|
ereport(ERROR, (errmsg("unsupported object %s for distribution by citus",
|
||||||
getObjectTypeDescription(dependency)),
|
getObjectTypeDescription_compat(dependency, /* missingOk: */ false)),
|
||||||
errdetail(
|
errdetail(
|
||||||
"citus tries to recreate an unsupported object on its workers"),
|
"citus tries to recreate an unsupported object on its workers"),
|
||||||
errhint("please report a bug as this should not be happening")));
|
errhint("please report a bug as this should not be happening")));
|
||||||
|
|
|
@ -1613,7 +1613,8 @@ PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString,
|
||||||
* workers
|
* workers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char *functionName = getObjectIdentity(&address);
|
const char *functionName =
|
||||||
|
getObjectIdentity_compat(&address, /* missingOk: */ false);
|
||||||
ereport(ERROR, (errmsg("distrtibuted functions are not allowed to depend on an "
|
ereport(ERROR, (errmsg("distrtibuted functions are not allowed to depend on an "
|
||||||
"extension"),
|
"extension"),
|
||||||
errdetail("Function \"%s\" is already distributed. Functions from "
|
errdetail("Function \"%s\" is already distributed. Functions from "
|
||||||
|
@ -1932,8 +1933,10 @@ ErrorIfFunctionDependsOnExtension(const ObjectAddress *functionAddress)
|
||||||
|
|
||||||
if (IsObjectAddressOwnedByExtension(functionAddress, &extensionAddress))
|
if (IsObjectAddressOwnedByExtension(functionAddress, &extensionAddress))
|
||||||
{
|
{
|
||||||
char *functionName = getObjectIdentity(functionAddress);
|
char *functionName =
|
||||||
char *extensionName = getObjectIdentity(&extensionAddress);
|
getObjectIdentity_compat(functionAddress, /* missingOk: */ false);
|
||||||
|
char *extensionName =
|
||||||
|
getObjectIdentity_compat(&extensionAddress, /* missingOk: */ false);
|
||||||
ereport(ERROR, (errmsg("unable to create a distributed function from functions "
|
ereport(ERROR, (errmsg("unable to create a distributed function from functions "
|
||||||
"owned by an extension"),
|
"owned by an extension"),
|
||||||
errdetail("Function \"%s\" has a dependency on extension \"%s\". "
|
errdetail("Function \"%s\" has a dependency on extension \"%s\". "
|
||||||
|
|
|
@ -973,7 +973,8 @@ CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress)
|
||||||
/* add owner ship change so the creation command can be run as a different user */
|
/* add owner ship change so the creation command can be run as a different user */
|
||||||
const char *username = GetUserNameFromId(GetTypeOwner(typeAddress->objectId), false);
|
const char *username = GetUserNameFromId(GetTypeOwner(typeAddress->objectId), false);
|
||||||
initStringInfo(&buf);
|
initStringInfo(&buf);
|
||||||
appendStringInfo(&buf, ALTER_TYPE_OWNER_COMMAND, getObjectIdentity(typeAddress),
|
appendStringInfo(&buf, ALTER_TYPE_OWNER_COMMAND,
|
||||||
|
getObjectIdentity_compat(typeAddress, false),
|
||||||
quote_identifier(username));
|
quote_identifier(username));
|
||||||
ddlCommands = lappend(ddlCommands, buf.data);
|
ddlCommands = lappend(ddlCommands, buf.data);
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ citus_unmark_object_distributed(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errmsg("object still exists"),
|
ereport(ERROR, (errmsg("object still exists"),
|
||||||
errdetail("the %s \"%s\" still exists",
|
errdetail("the %s \"%s\" still exists",
|
||||||
getObjectTypeDescription(&address),
|
getObjectTypeDescription_compat(&address, /* missingOk: */ false),
|
||||||
getObjectIdentity(&address)),
|
getObjectIdentity_compat(&address, /* missingOk: */ false)),
|
||||||
errhint("drop the object via a DROP command")));
|
errhint("drop the object via a DROP command")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,15 @@
|
||||||
#define F_NEXTVAL_COMPAT F_NEXTVAL
|
#define F_NEXTVAL_COMPAT F_NEXTVAL
|
||||||
#define ROLE_MONITOR_COMPAT ROLE_PG_MONITOR
|
#define ROLE_MONITOR_COMPAT ROLE_PG_MONITOR
|
||||||
#define STATUS_WAITING_COMPAT PROC_WAIT_STATUS_WAITING
|
#define STATUS_WAITING_COMPAT PROC_WAIT_STATUS_WAITING
|
||||||
|
#define getObjectTypeDescription_compat(a, b) getObjectTypeDescription(a, b)
|
||||||
|
#define getObjectIdentity_compat(a, b) getObjectIdentity(a, b)
|
||||||
#else
|
#else
|
||||||
#define AlterTableStmtObjType(a) ((a)->relkind)
|
#define AlterTableStmtObjType(a) ((a)->relkind)
|
||||||
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
|
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
|
||||||
#define ROLE_MONITOR_COMPAT DEFAULT_ROLE_MONITOR
|
#define ROLE_MONITOR_COMPAT DEFAULT_ROLE_MONITOR
|
||||||
#define STATUS_WAITING_COMPAT STATUS_WAITING
|
#define STATUS_WAITING_COMPAT STATUS_WAITING
|
||||||
|
#define getObjectTypeDescription_compat(a, b) getObjectTypeDescription(a)
|
||||||
|
#define getObjectIdentity_compat(a, b) getObjectIdentity(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_13
|
#if PG_VERSION_NUM >= PG_VERSION_13
|
||||||
|
|
Loading…
Reference in New Issue