Skip to content

Commit 9003c9f

Browse files
committed
Merge branch 'pgmaster' into logical_twophase
2 parents 270698e + 80a7298 commit 9003c9f

File tree

10 files changed

+65
-78
lines changed

10 files changed

+65
-78
lines changed

src/backend/catalog/aclchk.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ ExecuteGrantStmt(GrantStmt *stmt)
423423
grantee_uid = ACL_ID_PUBLIC;
424424
break;
425425
default:
426-
grantee_uid = get_rolespec_oid((Node *) grantee, false);
426+
grantee_uid = get_rolespec_oid(grantee, false);
427427
break;
428428
}
429429
istmt.grantees = lappend_oid(istmt.grantees, grantee_uid);
@@ -922,7 +922,7 @@ ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *s
922922
grantee_uid = ACL_ID_PUBLIC;
923923
break;
924924
default:
925-
grantee_uid = get_rolespec_oid((Node *) grantee, false);
925+
grantee_uid = get_rolespec_oid(grantee, false);
926926
break;
927927
}
928928
iacls.grantees = lappend_oid(iacls.grantees, grantee_uid);
@@ -1012,7 +1012,7 @@ ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *s
10121012
{
10131013
RoleSpec *rolespec = lfirst(rolecell);
10141014

1015-
iacls.roleid = get_rolespec_oid((Node *) rolespec, false);
1015+
iacls.roleid = get_rolespec_oid(rolespec, false);
10161016

10171017
/*
10181018
* We insist that calling user be a member of each target role. If

src/backend/commands/policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ policy_role_list_to_array(List *roles, int *num_roles)
177177
}
178178
else
179179
role_oids[i++] =
180-
ObjectIdGetDatum(get_rolespec_oid((Node *) spec, false));
180+
ObjectIdGetDatum(get_rolespec_oid(spec, false));
181181
}
182182

183183
return role_oids;

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
16041604
* execute if the user attempts to create a table with hundreds of
16051605
* thousands of columns.
16061606
*
1607-
* Note that we also need to check that any we do not exceed this figure
1607+
* Note that we also need to check that we do not exceed this figure
16081608
* after including columns from inherited relations.
16091609
*/
16101610
if (list_length(schema) > MaxHeapAttributeNumber)

src/backend/commands/user.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
449449
foreach(item, addroleto)
450450
{
451451
RoleSpec *oldrole = lfirst(item);
452-
HeapTuple oldroletup = get_rolespec_tuple((Node *) oldrole);
452+
HeapTuple oldroletup = get_rolespec_tuple(oldrole);
453453
Oid oldroleid = HeapTupleGetOid(oldroletup);
454454
char *oldrolename = NameStr(((Form_pg_authid) GETSTRUCT(oldroletup))->rolname);
455455

@@ -1396,9 +1396,11 @@ roleSpecsToIds(List *memberNames)
13961396

13971397
foreach(l, memberNames)
13981398
{
1399-
Node *rolespec = (Node *) lfirst(l);
1399+
RoleSpec *rolespec = (RoleSpec *) lfirst(l);
14001400
Oid roleid;
14011401

1402+
Assert(IsA(rolespec, RoleSpec));
1403+
14021404
roleid = get_rolespec_oid(rolespec, false);
14031405
result = lappend_oid(result, roleid);
14041406
}
@@ -1493,7 +1495,7 @@ AddRoleMems(const char *rolename, Oid roleid,
14931495
ereport(ERROR,
14941496
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
14951497
(errmsg("role \"%s\" is a member of role \"%s\"",
1496-
rolename, get_rolespec_name((Node *) memberRole)))));
1498+
rolename, get_rolespec_name(memberRole)))));
14971499

14981500
/*
14991501
* Check if entry for this role/member already exists; if so, give
@@ -1508,7 +1510,7 @@ AddRoleMems(const char *rolename, Oid roleid,
15081510
{
15091511
ereport(NOTICE,
15101512
(errmsg("role \"%s\" is already a member of role \"%s\"",
1511-
get_rolespec_name((Node *) memberRole), rolename)));
1513+
get_rolespec_name(memberRole), rolename)));
15121514
ReleaseSysCache(authmem_tuple);
15131515
continue;
15141516
}
@@ -1619,7 +1621,7 @@ DelRoleMems(const char *rolename, Oid roleid,
16191621
{
16201622
ereport(WARNING,
16211623
(errmsg("role \"%s\" is not a member of role \"%s\"",
1622-
get_rolespec_name((Node *) memberRole), rolename)));
1624+
get_rolespec_name(memberRole), rolename)));
16231625
continue;
16241626
}
16251627

src/backend/parser/gram.y

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static Node *makeBitStringConst(char *str, int location);
144144
static Node *makeNullAConst(int location);
145145
static Node *makeAConst(Value *v, int location);
146146
static Node *makeBoolAConst(bool state, int location);
147-
static Node *makeRoleSpec(RoleSpecType type, int location);
147+
static RoleSpec *makeRoleSpec(RoleSpecType type, int location);
148148
static void check_qualified_name(List *names, core_yyscan_t yyscanner);
149149
static List *check_func_name(List *names, core_yyscan_t yyscanner);
150150
static List *check_indirection(List *indirection, core_yyscan_t yyscanner);
@@ -231,6 +231,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
231231
PartitionElem *partelem;
232232
PartitionSpec *partspec;
233233
PartitionRangeDatum *partrange_datum;
234+
RoleSpec *rolespec;
234235
}
235236

236237
%type <node> stmt schema_stmt
@@ -339,7 +340,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
339340
%type <list> RowSecurityDefaultToRole RowSecurityOptionalToRole
340341

341342
%type <str> iso_level opt_encoding
342-
%type <node> grantee
343+
%type <rolespec> grantee
343344
%type <list> grantee_list
344345
%type <accesspriv> privilege
345346
%type <list> privileges privilege_list
@@ -506,7 +507,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
506507
%type <str> NonReservedWord NonReservedWord_or_Sconst
507508
%type <str> createdb_opt_name
508509
%type <node> var_value zone_value
509-
%type <node> auth_ident RoleSpec opt_granted_by
510+
%type <rolespec> auth_ident RoleSpec opt_granted_by
510511

511512
%type <keyword> unreserved_keyword type_func_name_keyword
512513
%type <keyword> col_name_keyword reserved_keyword
@@ -522,7 +523,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
522523
%type <list> constraints_set_list
523524
%type <boolean> constraints_set_mode
524525
%type <str> OptTableSpace OptConsTableSpace
525-
%type <node> OptTableSpaceOwner
526+
%type <rolespec> OptTableSpaceOwner
526527
%type <ival> opt_check_option
527528

528529
%type <str> opt_provider security_label
@@ -13918,10 +13919,10 @@ RoleSpec: NonReservedWord
1391813919
}
1391913920
else
1392013921
{
13921-
n = (RoleSpec *) makeRoleSpec(ROLESPEC_CSTRING, @1);
13922+
n = makeRoleSpec(ROLESPEC_CSTRING, @1);
1392213923
n->rolename = pstrdup($1);
1392313924
}
13924-
$$ = (Node *) n;
13925+
$$ = n;
1392513926
}
1392613927
| CURRENT_USER
1392713928
{
@@ -14644,15 +14645,15 @@ makeBoolAConst(bool state, int location)
1464414645
/* makeRoleSpec
1464514646
* Create a RoleSpec with the given type
1464614647
*/
14647-
static Node *
14648+
static RoleSpec *
1464814649
makeRoleSpec(RoleSpecType type, int location)
1464914650
{
1465014651
RoleSpec *spec = makeNode(RoleSpec);
1465114652

1465214653
spec->roletype = type;
1465314654
spec->location = location;
1465414655

14655-
return (Node *) spec;
14656+
return spec;
1465614657
}
1465714658

1465814659
/* check_qualified_name --- check the result of qualified_name production

src/backend/utils/adt/acl.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5143,15 +5143,10 @@ get_role_oid_or_public(const char *rolname)
51435143
* case must check the case separately.
51445144
*/
51455145
Oid
5146-
get_rolespec_oid(const Node *node, bool missing_ok)
5146+
get_rolespec_oid(const RoleSpec *role, bool missing_ok)
51475147
{
5148-
RoleSpec *role;
51495148
Oid oid;
51505149

5151-
if (!IsA(node, RoleSpec))
5152-
elog(ERROR, "invalid node type %d", node->type);
5153-
5154-
role = (RoleSpec *) node;
51555150
switch (role->roletype)
51565151
{
51575152
case ROLESPEC_CSTRING:
@@ -5186,15 +5181,10 @@ get_rolespec_oid(const Node *node, bool missing_ok)
51865181
* Caller must ReleaseSysCache when done with the result tuple.
51875182
*/
51885183
HeapTuple
5189-
get_rolespec_tuple(const Node *node)
5184+
get_rolespec_tuple(const RoleSpec *role)
51905185
{
5191-
RoleSpec *role;
51925186
HeapTuple tuple;
51935187

5194-
role = (RoleSpec *) node;
5195-
if (!IsA(node, RoleSpec))
5196-
elog(ERROR, "invalid node type %d", node->type);
5197-
51985188
switch (role->roletype)
51995189
{
52005190
case ROLESPEC_CSTRING:
@@ -5235,13 +5225,13 @@ get_rolespec_tuple(const Node *node)
52355225
* Given a RoleSpec, returns a palloc'ed copy of the corresponding role's name.
52365226
*/
52375227
char *
5238-
get_rolespec_name(const Node *node)
5228+
get_rolespec_name(const RoleSpec *role)
52395229
{
52405230
HeapTuple tp;
52415231
Form_pg_authid authForm;
52425232
char *rolename;
52435233

5244-
tp = get_rolespec_tuple(node);
5234+
tp = get_rolespec_tuple(role);
52455235
authForm = (Form_pg_authid) GETSTRUCT(tp);
52465236
rolename = pstrdup(NameStr(authForm->rolname));
52475237
ReleaseSysCache(tp);
@@ -5257,17 +5247,11 @@ get_rolespec_name(const Node *node)
52575247
* message is provided.
52585248
*/
52595249
void
5260-
check_rolespec_name(const Node *node, const char *detail_msg)
5250+
check_rolespec_name(const RoleSpec *role, const char *detail_msg)
52615251
{
5262-
RoleSpec *role;
5263-
5264-
if (!node)
5252+
if (!role)
52655253
return;
52665254

5267-
role = (RoleSpec *) node;
5268-
5269-
Assert(IsA(node, RoleSpec));
5270-
52715255
if (role->roletype != ROLESPEC_CSTRING)
52725256
return;
52735257

src/include/catalog/pg_proc.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,9 +2837,9 @@ DESCR("statistics: number of temporary files written");
28372837
DATA(insert OID = 3151 ( pg_stat_get_db_temp_bytes PGNSP PGUID 12 1 0 0 0 f f f f t f s r 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_temp_bytes _null_ _null_ _null_ ));
28382838
DESCR("statistics: number of bytes in temporary files written");
28392839
DATA(insert OID = 2844 ( pg_stat_get_db_blk_read_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_blk_read_time _null_ _null_ _null_ ));
2840-
DESCR("statistics: block read time, in msec");
2840+
DESCR("statistics: block read time, in milliseconds");
28412841
DATA(insert OID = 2845 ( pg_stat_get_db_blk_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_db_blk_write_time _null_ _null_ _null_ ));
2842-
DESCR("statistics: block write time, in msec");
2842+
DESCR("statistics: block write time, in milliseconds");
28432843
DATA(insert OID = 3195 ( pg_stat_get_archiver PGNSP PGUID 12 1 0 0 0 f f f f f f s r 0 0 2249 "" "{20,25,1184,20,25,1184,1184}" "{o,o,o,o,o,o,o}" "{archived_count,last_archived_wal,last_archived_time,failed_count,last_failed_wal,last_failed_time,stats_reset}" _null_ _null_ pg_stat_get_archiver _null_ _null_ _null_ ));
28442844
DESCR("statistics: information about WAL archiver");
28452845
DATA(insert OID = 2769 ( pg_stat_get_bgwriter_timed_checkpoints PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_timed_checkpoints _null_ _null_ _null_ ));
@@ -2855,9 +2855,9 @@ DESCR("statistics: number of times the bgwriter stopped processing when it had w
28552855
DATA(insert OID = 3075 ( pg_stat_get_bgwriter_stat_reset_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_bgwriter_stat_reset_time _null_ _null_ _null_ ));
28562856
DESCR("statistics: last reset for the bgwriter");
28572857
DATA(insert OID = 3160 ( pg_stat_get_checkpoint_write_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 701 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_write_time _null_ _null_ _null_ ));
2858-
DESCR("statistics: checkpoint time spent writing buffers to disk, in msec");
2858+
DESCR("statistics: checkpoint time spent writing buffers to disk, in milliseconds");
28592859
DATA(insert OID = 3161 ( pg_stat_get_checkpoint_sync_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 701 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_checkpoint_sync_time _null_ _null_ _null_ ));
2860-
DESCR("statistics: checkpoint time spent synchronizing buffers to disk, in msec");
2860+
DESCR("statistics: checkpoint time spent synchronizing buffers to disk, in milliseconds");
28612861
DATA(insert OID = 2775 ( pg_stat_get_buf_written_backend PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_buf_written_backend _null_ _null_ _null_ ));
28622862
DESCR("statistics: number of buffers written by backends");
28632863
DATA(insert OID = 3063 ( pg_stat_get_buf_fsync_backend PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 20 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_buf_fsync_backend _null_ _null_ _null_ ));
@@ -2868,9 +2868,9 @@ DESCR("statistics: number of buffer allocations");
28682868
DATA(insert OID = 2978 ( pg_stat_get_function_calls PGNSP PGUID 12 1 0 0 0 f f f f t f s r 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_function_calls _null_ _null_ _null_ ));
28692869
DESCR("statistics: number of function calls");
28702870
DATA(insert OID = 2979 ( pg_stat_get_function_total_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_function_total_time _null_ _null_ _null_ ));
2871-
DESCR("statistics: total execution time of function, in msec");
2871+
DESCR("statistics: total execution time of function, in milliseconds");
28722872
DATA(insert OID = 2980 ( pg_stat_get_function_self_time PGNSP PGUID 12 1 0 0 0 f f f f t f s r 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_function_self_time _null_ _null_ _null_ ));
2873-
DESCR("statistics: self execution time of function, in msec");
2873+
DESCR("statistics: self execution time of function, in milliseconds");
28742874

28752875
DATA(insert OID = 3037 ( pg_stat_get_xact_numscans PGNSP PGUID 12 1 0 0 0 f f f f t f v r 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_numscans _null_ _null_ _null_ ));
28762876
DESCR("statistics: number of scans done for table/index in current transaction");
@@ -2893,9 +2893,9 @@ DESCR("statistics: number of blocks found in cache in current transaction");
28932893
DATA(insert OID = 3046 ( pg_stat_get_xact_function_calls PGNSP PGUID 12 1 0 0 0 f f f f t f v r 1 0 20 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_function_calls _null_ _null_ _null_ ));
28942894
DESCR("statistics: number of function calls in current transaction");
28952895
DATA(insert OID = 3047 ( pg_stat_get_xact_function_total_time PGNSP PGUID 12 1 0 0 0 f f f f t f v r 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_function_total_time _null_ _null_ _null_ ));
2896-
DESCR("statistics: total execution time of function in current transaction, in msec");
2896+
DESCR("statistics: total execution time of function in current transaction, in milliseconds");
28972897
DATA(insert OID = 3048 ( pg_stat_get_xact_function_self_time PGNSP PGUID 12 1 0 0 0 f f f f t f v r 1 0 701 "26" _null_ _null_ _null_ _null_ _null_ pg_stat_get_xact_function_self_time _null_ _null_ _null_ ));
2898-
DESCR("statistics: self execution time of function in current transaction, in msec");
2898+
DESCR("statistics: self execution time of function in current transaction, in milliseconds");
28992899

29002900
DATA(insert OID = 3788 ( pg_stat_get_snapshot_timestamp PGNSP PGUID 12 1 0 0 0 f f f f t f s r 0 0 1184 "" _null_ _null_ _null_ _null_ _null_ pg_stat_get_snapshot_timestamp _null_ _null_ _null_ ));
29012901
DESCR("statistics: timestamp of the current statistics snapshot");

src/include/nodes/nodes.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
* The first field of every node is NodeTag. Each node created (with makeNode)
1919
* will have one of the following tags as the value of its first field.
2020
*
21-
* Note that the numbers of the node tags are not contiguous. We left holes
22-
* here so that we can add more tags without changing the existing enum's.
23-
* (Since node tag numbers never exist outside backend memory, there's no
24-
* real harm in renumbering, it just costs a full rebuild ...)
21+
* Note that inserting or deleting node types changes the numbers of other
22+
* node types later in the list. This is no problem during development, since
23+
* the node numbers are never stored on disk. But don't do it in a released
24+
* branch, because that would represent an ABI break for extensions.
2525
*/
2626
typedef enum NodeTag
2727
{
@@ -30,7 +30,7 @@ typedef enum NodeTag
3030
/*
3131
* TAGS FOR EXECUTOR NODES (execnodes.h)
3232
*/
33-
T_IndexInfo = 10,
33+
T_IndexInfo,
3434
T_ExprContext,
3535
T_ProjectionInfo,
3636
T_JunkFilter,
@@ -41,7 +41,7 @@ typedef enum NodeTag
4141
/*
4242
* TAGS FOR PLAN NODES (plannodes.h)
4343
*/
44-
T_Plan = 100,
44+
T_Plan,
4545
T_Result,
4646
T_ModifyTable,
4747
T_Append,
@@ -89,7 +89,7 @@ typedef enum NodeTag
8989
*
9090
* These should correspond one-to-one with Plan node types.
9191
*/
92-
T_PlanState = 200,
92+
T_PlanState,
9393
T_ResultState,
9494
T_ModifyTableState,
9595
T_AppendState,
@@ -131,7 +131,7 @@ typedef enum NodeTag
131131
/*
132132
* TAGS FOR PRIMITIVE NODES (primnodes.h)
133133
*/
134-
T_Alias = 300,
134+
T_Alias,
135135
T_RangeVar,
136136
T_Expr,
137137
T_Var,
@@ -188,7 +188,7 @@ typedef enum NodeTag
188188
* These correspond (not always one-for-one) to primitive nodes derived
189189
* from Expr.
190190
*/
191-
T_ExprState = 400,
191+
T_ExprState,
192192
T_GenericExprState,
193193
T_WholeRowVarExprState,
194194
T_AggrefExprState,
@@ -220,7 +220,7 @@ typedef enum NodeTag
220220
/*
221221
* TAGS FOR PLANNER NODES (relation.h)
222222
*/
223-
T_PlannerInfo = 500,
223+
T_PlannerInfo,
224224
T_PlannerGlobal,
225225
T_RelOptInfo,
226226
T_IndexOptInfo,
@@ -273,13 +273,13 @@ typedef enum NodeTag
273273
/*
274274
* TAGS FOR MEMORY NODES (memnodes.h)
275275
*/
276-
T_MemoryContext = 600,
276+
T_MemoryContext,
277277
T_AllocSetContext,
278278

279279
/*
280280
* TAGS FOR VALUE NODES (value.h)
281281
*/
282-
T_Value = 650,
282+
T_Value,
283283
T_Integer,
284284
T_Float,
285285
T_String,
@@ -301,7 +301,7 @@ typedef enum NodeTag
301301
/*
302302
* TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
303303
*/
304-
T_Query = 700,
304+
T_Query,
305305
T_PlannedStmt,
306306
T_InsertStmt,
307307
T_DeleteStmt,
@@ -411,7 +411,7 @@ typedef enum NodeTag
411411
/*
412412
* TAGS FOR PARSE TREE NODES (parsenodes.h)
413413
*/
414-
T_A_Expr = 900,
414+
T_A_Expr,
415415
T_ColumnRef,
416416
T_ParamRef,
417417
T_A_Const,
@@ -478,7 +478,7 @@ typedef enum NodeTag
478478
* purposes (usually because they are involved in APIs where we want to
479479
* pass multiple object types through the same pointer).
480480
*/
481-
T_TriggerData = 950, /* in commands/trigger.h */
481+
T_TriggerData, /* in commands/trigger.h */
482482
T_EventTriggerData, /* in commands/event_trigger.h */
483483
T_ReturnSetInfo, /* in nodes/execnodes.h */
484484
T_WindowObjectData, /* private in nodeWindowAgg.c */

0 commit comments

Comments
 (0)