Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit49f9a28

Browse files
committed
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 hiscorrection of copynodes/equalnodes handling of the CreatePolicyStmt'cmd' field.Back-patch to 9.5 where the CreatePolicyStmt was introduced, as weare still only in alpha.
1 parent0070fd8 commit49f9a28

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

‎src/backend/commands/policy.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,25 @@ RangeVarCallbackForPolicy(const RangeVar *rv, Oid relid, Oid oldrelid,
108108
staticchar
109109
parse_policy_command(constchar*cmd_name)
110110
{
111-
charcmd;
111+
charpolcmd;
112112

113113
if (!cmd_name)
114114
elog(ERROR,"unrecognized policy command");
115115

116116
if (strcmp(cmd_name,"all")==0)
117-
cmd='*';
117+
polcmd='*';
118118
elseif (strcmp(cmd_name,"select")==0)
119-
cmd=ACL_SELECT_CHR;
119+
polcmd=ACL_SELECT_CHR;
120120
elseif (strcmp(cmd_name,"insert")==0)
121-
cmd=ACL_INSERT_CHR;
121+
polcmd=ACL_INSERT_CHR;
122122
elseif (strcmp(cmd_name,"update")==0)
123-
cmd=ACL_UPDATE_CHR;
123+
polcmd=ACL_UPDATE_CHR;
124124
elseif (strcmp(cmd_name,"delete")==0)
125-
cmd=ACL_DELETE_CHR;
125+
polcmd=ACL_DELETE_CHR;
126126
else
127127
elog(ERROR,"unrecognized policy command");
128128

129-
returncmd;
129+
returnpolcmd;
130130
}
131131

132132
/*
@@ -480,7 +480,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
480480
inti;
481481

482482
/* Parse command */
483-
polcmd=parse_policy_command(stmt->cmd);
483+
polcmd=parse_policy_command(stmt->cmd_name);
484484

485485
/*
486486
* If the command is SELECT or DELETE then WITH CHECK should be NULL.
@@ -674,7 +674,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
674674
boolreplaces[Natts_pg_policy];
675675
ObjectAddresstarget;
676676
ObjectAddressmyself;
677-
Datumcmd_datum;
677+
Datumpolcmd_datum;
678678
charpolcmd;
679679
boolpolcmd_isnull;
680680
inti;
@@ -775,11 +775,11 @@ AlterPolicy(AlterPolicyStmt *stmt)
775775
RelationGetRelationName(target_table))));
776776

777777
/* Get policy command */
778-
cmd_datum=heap_getattr(policy_tuple,Anum_pg_policy_polcmd,
778+
polcmd_datum=heap_getattr(policy_tuple,Anum_pg_policy_polcmd,
779779
RelationGetDescr(pg_policy_rel),
780780
&polcmd_isnull);
781781
Assert(!polcmd_isnull);
782-
polcmd=DatumGetChar(cmd_datum);
782+
polcmd=DatumGetChar(polcmd_datum);
783783

784784
/*
785785
* If the command is SELECT or DELETE then WITH CHECK should be NULL.

‎src/backend/nodes/copyfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4071,7 +4071,7 @@ _copyCreatePolicyStmt(const CreatePolicyStmt *from)
40714071

40724072
COPY_STRING_FIELD(policy_name);
40734073
COPY_NODE_FIELD(table);
4074-
COPY_STRING_FIELD(cmd);
4074+
COPY_STRING_FIELD(cmd_name);
40754075
COPY_NODE_FIELD(roles);
40764076
COPY_NODE_FIELD(qual);
40774077
COPY_NODE_FIELD(with_check);

‎src/backend/nodes/equalfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ _equalCreatePolicyStmt(const CreatePolicyStmt *a, const CreatePolicyStmt *b)
20642064
{
20652065
COMPARE_STRING_FIELD(policy_name);
20662066
COMPARE_NODE_FIELD(table);
2067-
COMPARE_STRING_FIELD(cmd);
2067+
COMPARE_STRING_FIELD(cmd_name);
20682068
COMPARE_NODE_FIELD(roles);
20692069
COMPARE_NODE_FIELD(qual);
20702070
COMPARE_NODE_FIELD(with_check);

‎src/backend/parser/gram.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4592,7 +4592,7 @@ CreatePolicyStmt:
45924592
CreatePolicyStmt *n = makeNode(CreatePolicyStmt);
45934593
n->policy_name =$3;
45944594
n->table =$5;
4595-
n->cmd =$6;
4595+
n->cmd_name =$6;
45964596
n->roles =$7;
45974597
n->qual =$8;
45984598
n->with_check =$9;

‎src/include/nodes/parsenodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ typedef struct CreatePolicyStmt
20392039
NodeTagtype;
20402040
char*policy_name;/* Policy's name */
20412041
RangeVar*table;/* the table name the policy applies to */
2042-
char*cmd;/* the command name the policy applies to */
2042+
char*cmd_name;/* the command name the policy applies to */
20432043
List*roles;/* the roles associated with the policy */
20442044
Node*qual;/* the policy's condition */
20452045
Node*with_check;/* the policy's WITH CHECK condition. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp