From 7766bcbd856e88b0c25ff21c837a6c77cfe36653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Villemain?= Date: Sun, 9 Mar 2025 14:41:03 +0100 Subject: [PATCH] Add column level support for GRANT command Partial support (not covering special case with `ALL`), just append the cols to the privilege string. --- src/backend/distributed/commands/grant.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/distributed/commands/grant.c b/src/backend/distributed/commands/grant.c index 765ca06c9..a2645c33f 100644 --- a/src/backend/distributed/commands/grant.c +++ b/src/backend/distributed/commands/grant.c @@ -17,6 +17,7 @@ #include "distributed/citus_ruleutils.h" #include "distributed/commands.h" #include "distributed/commands/utility_hook.h" +#include "distributed/deparser.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_cache.h" #include "distributed/version_compat.h" @@ -32,7 +33,6 @@ static List * CollectGrantTableIdList(GrantStmt *grantStmt); * needed during the worker node portion of DDL execution before returning the * DDLJobs in a List. If no distributed table is involved, this returns NIL. * - * NB: So far column level privileges are not supported. */ List * PreprocessGrantStmt(Node *node, const char *queryString, @@ -96,9 +96,11 @@ PreprocessGrantStmt(Node *node, const char *queryString, if (priv->cols != NIL) { - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("grant/revoke on column list is currently " - "unsupported"))); + StringInfoData colsString; + initStringInfo(&colsString); + + AppendColumnNameList(&colsString, priv->cols); + appendStringInfo(&privsString, "%s", colsString.data); } } }