summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Frost2015-08-21 12:22:22 +0000
committerStephen Frost2015-08-21 12:22:22 +0000
commit3c99788797e8269ac19c7c8e3fb99dd9613646ea (patch)
tree8eb014ff3ba91fd1a06c84c0123a7951d89a9171 /src
parent7ec8296e70f0f03cbdb3e0eb4f05ad5be0f810c8 (diff)
Rename 'cmd' to 'cmd_name' in CreatePolicyStmt
To avoid confusion, rename CreatePolicyStmt's 'cmd' to 'cmd_name', parse_policy_command's 'cmd' to 'polcmd', and AlterPolicy's 'cmd_datum' to 'polcmd_datum', per discussion with Noah and as a follow-up to his correction of copynodes/equalnodes handling of the CreatePolicyStmt 'cmd' field. Back-patch to 9.5 where the CreatePolicyStmt was introduced, as we are still only in alpha.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/policy.c22
-rw-r--r--src/backend/nodes/copyfuncs.c2
-rw-r--r--src/backend/nodes/equalfuncs.c2
-rw-r--r--src/backend/parser/gram.y2
-rw-r--r--src/include/nodes/parsenodes.h2
5 files changed, 15 insertions, 15 deletions
diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index bcf4a8f35d1..45326a3bec4 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -108,25 +108,25 @@ RangeVarCallbackForPolicy(const RangeVar *rv, Oid relid, Oid oldrelid,
static char
parse_policy_command(const char *cmd_name)
{
- char cmd;
+ char polcmd;
if (!cmd_name)
elog(ERROR, "unrecognized policy command");
if (strcmp(cmd_name, "all") == 0)
- cmd = '*';
+ polcmd = '*';
else if (strcmp(cmd_name, "select") == 0)
- cmd = ACL_SELECT_CHR;
+ polcmd = ACL_SELECT_CHR;
else if (strcmp(cmd_name, "insert") == 0)
- cmd = ACL_INSERT_CHR;
+ polcmd = ACL_INSERT_CHR;
else if (strcmp(cmd_name, "update") == 0)
- cmd = ACL_UPDATE_CHR;
+ polcmd = ACL_UPDATE_CHR;
else if (strcmp(cmd_name, "delete") == 0)
- cmd = ACL_DELETE_CHR;
+ polcmd = ACL_DELETE_CHR;
else
elog(ERROR, "unrecognized policy command");
- return cmd;
+ return polcmd;
}
/*
@@ -480,7 +480,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
int i;
/* Parse command */
- polcmd = parse_policy_command(stmt->cmd);
+ polcmd = parse_policy_command(stmt->cmd_name);
/*
* If the command is SELECT or DELETE then WITH CHECK should be NULL.
@@ -674,7 +674,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
bool replaces[Natts_pg_policy];
ObjectAddress target;
ObjectAddress myself;
- Datum cmd_datum;
+ Datum polcmd_datum;
char polcmd;
bool polcmd_isnull;
int i;
@@ -775,11 +775,11 @@ AlterPolicy(AlterPolicyStmt *stmt)
RelationGetRelationName(target_table))));
/* Get policy command */
- cmd_datum = heap_getattr(policy_tuple, Anum_pg_policy_polcmd,
+ polcmd_datum = heap_getattr(policy_tuple, Anum_pg_policy_polcmd,
RelationGetDescr(pg_policy_rel),
&polcmd_isnull);
Assert(!polcmd_isnull);
- polcmd = DatumGetChar(cmd_datum);
+ polcmd = DatumGetChar(polcmd_datum);
/*
* If the command is SELECT or DELETE then WITH CHECK should be NULL.
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 1c8425d37d4..bd2e80e2d1d 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -4083,7 +4083,7 @@ _copyCreatePolicyStmt(const CreatePolicyStmt *from)
COPY_STRING_FIELD(policy_name);
COPY_NODE_FIELD(table);
- COPY_STRING_FIELD(cmd);
+ COPY_STRING_FIELD(cmd_name);
COPY_NODE_FIELD(roles);
COPY_NODE_FIELD(qual);
COPY_NODE_FIELD(with_check);
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 1d6c43c2d6b..19412fee662 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -2074,7 +2074,7 @@ _equalCreatePolicyStmt(const CreatePolicyStmt *a, const CreatePolicyStmt *b)
{
COMPARE_STRING_FIELD(policy_name);
COMPARE_NODE_FIELD(table);
- COMPARE_STRING_FIELD(cmd);
+ COMPARE_STRING_FIELD(cmd_name);
COMPARE_NODE_FIELD(roles);
COMPARE_NODE_FIELD(qual);
COMPARE_NODE_FIELD(with_check);
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 426a09dac38..1efc6d66d70 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -4613,7 +4613,7 @@ CreatePolicyStmt:
CreatePolicyStmt *n = makeNode(CreatePolicyStmt);
n->policy_name = $3;
n->table = $5;
- n->cmd = $6;
+ n->cmd_name = $6;
n->roles = $7;
n->qual = $8;
n->with_check = $9;
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 151c93a078e..f0dcd2fa6e2 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2039,7 +2039,7 @@ typedef struct CreatePolicyStmt
NodeTag type;
char *policy_name; /* Policy's name */
RangeVar *table; /* the table name the policy applies to */
- char *cmd; /* the command name the policy applies to */
+ char *cmd_name; /* the command name the policy applies to */
List *roles; /* the roles associated with the policy */
Node *qual; /* the policy's condition */
Node *with_check; /* the policy's WITH CHECK condition. */