mirror of https://github.com/citusdata/citus.git
PG16 compatibility - fix AM dependency and grant's admin option (#7113)
PG16 compatibility - part 11 Check out part 1pull/7116/head42d956888d
part 20d503dd5ac
part 3907d72e60d
part 47c6b4ce103
part 56056cb2c29
part 6b36c431abb
part 7ee3153fe50
part 82c50b5f7ff
part 9b2291374b4
part 10a2315fdc67
This commit is in the series of PG16 compatibility commits. It fixes AM dependency and grant's admin option: - Fix with admin option in grants grantstmt->admin_opt no longer exists in PG16 instead, grantstmt has a list of options, one of them is admin option. Relevant PG commit:e3ce2de09d
e3ce2de09d814f8770b2e3b3c152b7671bcdb83f - Fix pg_depend entry to AMs after ALTER TABLE .. SET ACCESS METHOD Relevant PG commit:97d8910104
97d89101045fac8cb36f4ef6c08526ea0841a596 More PG16 compatibility commits are coming soon: We are very close to merging "PG16Beta3 Support - Regression tests sanity"
parent
71c475af52
commit
9fa72545e2
|
@ -819,12 +819,15 @@ GenerateGrantRoleStmtsFromOptions(RoleSpec *roleSpec, List *options)
|
|||
grantRoleStmt->grantee_roles = list_make1(roleSpec);
|
||||
}
|
||||
|
||||
#if PG_VERSION_NUM < PG_VERSION_16
|
||||
if (strcmp(option->defname, "adminmembers") == 0)
|
||||
{
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
DefElem *opt = makeDefElem("admin", (Node *) makeBoolean(true), -1);
|
||||
grantRoleStmt->opt = list_make1(opt);
|
||||
#else
|
||||
grantRoleStmt->admin_opt = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
stmts = lappend(stmts, grantRoleStmt);
|
||||
}
|
||||
|
@ -871,7 +874,13 @@ GenerateGrantRoleStmtsOfRole(Oid roleid)
|
|||
|
||||
grantRoleStmt->grantor = NULL;
|
||||
|
||||
#if PG_VERSION_NUM < PG_VERSION_16
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
if (membership->admin_option)
|
||||
{
|
||||
DefElem *opt = makeDefElem("admin", (Node *) makeBoolean(true), -1);
|
||||
grantRoleStmt->opt = list_make1(opt);
|
||||
}
|
||||
#else
|
||||
grantRoleStmt->admin_opt = membership->admin_option;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
#include "utils/builtins.h"
|
||||
|
@ -349,7 +350,20 @@ AppendGrantRoleStmt(StringInfo buf, GrantRoleStmt *stmt)
|
|||
{
|
||||
appendStringInfo(buf, "%s ", stmt->is_grant ? "GRANT" : "REVOKE");
|
||||
|
||||
#if PG_VERSION_NUM < PG_VERSION_16
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
if (!stmt->is_grant)
|
||||
{
|
||||
DefElem *opt = NULL;
|
||||
foreach_ptr(opt, stmt->opt)
|
||||
{
|
||||
if (strcmp(opt->defname, "admin") == 0)
|
||||
{
|
||||
appendStringInfo(buf, "ADMIN OPTION FOR ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!stmt->is_grant && stmt->admin_opt)
|
||||
{
|
||||
appendStringInfo(buf, "ADMIN OPTION FOR ");
|
||||
|
@ -364,7 +378,17 @@ AppendGrantRoleStmt(StringInfo buf, GrantRoleStmt *stmt)
|
|||
|
||||
if (stmt->is_grant)
|
||||
{
|
||||
#if PG_VERSION_NUM < PG_VERSION_16
|
||||
#if PG_VERSION_NUM >= PG_VERSION_16
|
||||
DefElem *opt = NULL;
|
||||
foreach_ptr(opt, stmt->opt)
|
||||
{
|
||||
if (strcmp(opt->defname, "admin") == 0)
|
||||
{
|
||||
appendStringInfo(buf, " WITH ADMIN OPTION");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (stmt->admin_opt)
|
||||
{
|
||||
appendStringInfo(buf, " WITH ADMIN OPTION");
|
||||
|
|
|
@ -1022,11 +1022,12 @@ GetUndistributableDependency(const ObjectAddress *objectAddress)
|
|||
if (!SupportedDependencyByCitus(dependency))
|
||||
{
|
||||
/*
|
||||
* Since we do not yet support distributed TS TEMPLATE objects, we skip
|
||||
* Since we do not yet support distributed TS TEMPLATE and AM objects, we skip
|
||||
* dependency checks for text search templates. The user is expected to
|
||||
* manually create the TS TEMPLATE objects.
|
||||
* manually create the TS TEMPLATE and AM objects.
|
||||
*/
|
||||
if (getObjectClass(dependency) != OCLASS_TSTEMPLATE)
|
||||
if (getObjectClass(dependency) != OCLASS_TSTEMPLATE &&
|
||||
getObjectClass(dependency) != OCLASS_AM)
|
||||
{
|
||||
return dependency;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue