Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5d29d52

Browse files
committed
Rework format of comments in headers for nodes
This is similar to 835d476, except that this one is to add node attributes related to query jumbling and avoid long lines in the headers and in the node structures changed by this commit. Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/Y5BHOUhX3zTH/ig6@paquier.xyz
1 parent 8eba3e3 commit 5d29d52

File tree

2 files changed

+398
-202
lines changed

2 files changed

+398
-202
lines changed

src/include/nodes/parsenodes.h

+114-56
Original file line numberDiff line numberDiff line change
@@ -123,47 +123,67 @@ typedef struct Query
123123

124124
CmdType commandType; /* select|insert|update|delete|merge|utility */
125125

126-
QuerySource querySource; /* where did I come from? */
126+
/* where did I come from? */
127+
QuerySource querySource;
127128

128129
/*
129130
* query identifier (can be set by plugins); ignored for equal, as it
130131
* might not be set; also not stored
131132
*/
132133
uint64 queryId pg_node_attr(equal_ignore, read_write_ignore, read_as(0));
133134

134-
bool canSetTag; /* do I set the command result tag? */
135+
/* do I set the command result tag? */
136+
bool canSetTag;
135137

136138
Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
137139

138-
int resultRelation; /* rtable index of target relation for
139-
* INSERT/UPDATE/DELETE/MERGE; 0 for SELECT */
140-
141-
bool hasAggs; /* has aggregates in tlist or havingQual */
142-
bool hasWindowFuncs; /* has window functions in tlist */
143-
bool hasTargetSRFs; /* has set-returning functions in tlist */
144-
bool hasSubLinks; /* has subquery SubLink */
145-
bool hasDistinctOn; /* distinctClause is from DISTINCT ON */
146-
bool hasRecursive; /* WITH RECURSIVE was specified */
147-
bool hasModifyingCTE; /* has INSERT/UPDATE/DELETE in WITH */
148-
bool hasForUpdate; /* FOR [KEY] UPDATE/SHARE was specified */
149-
bool hasRowSecurity; /* rewriter has applied some RLS policy */
150-
151-
bool isReturn; /* is a RETURN statement */
140+
/*
141+
* rtable index of target relation for INSERT/UPDATE/DELETE/MERGE; 0 for
142+
* SELECT.
143+
*/
144+
int resultRelation;
145+
146+
/* has aggregates in tlist or havingQual */
147+
bool hasAggs;
148+
/* has window functions in tlist */
149+
bool hasWindowFuncs;
150+
/* has set-returning functions in tlist */
151+
bool hasTargetSRFs;
152+
/* has subquery SubLink */
153+
bool hasSubLinks;
154+
/* distinctClause is from DISTINCT ON */
155+
bool hasDistinctOn;
156+
/* WITH RECURSIVE was specified */
157+
bool hasRecursive;
158+
/* has INSERT/UPDATE/DELETE in WITH */
159+
bool hasModifyingCTE;
160+
/* FOR [KEY] UPDATE/SHARE was specified */
161+
bool hasForUpdate;
162+
/* rewriter has applied some RLS policy */
163+
bool hasRowSecurity;
164+
/* is a RETURN statement */
165+
bool isReturn;
152166

153167
List *cteList; /* WITH list (of CommonTableExpr's) */
154168

155169
List *rtable; /* list of range table entries */
156-
List *rteperminfos; /* list of RTEPermissionInfo nodes for the
157-
* rtable entries having perminfoindex > 0 */
170+
171+
/*
172+
* list of RTEPermissionInfo nodes for the rtable entries having
173+
* perminfoindex > 0
174+
*/
175+
List *rteperminfos;
158176
FromExpr *jointree; /* table join tree (FROM and WHERE clauses);
159177
* also USING clause for MERGE */
160178

161179
List *mergeActionList; /* list of actions for MERGE (only) */
162-
bool mergeUseOuterJoin; /* whether to use outer join */
180+
/* whether to use outer join */
181+
bool mergeUseOuterJoin;
163182

164183
List *targetList; /* target list (of TargetEntry) */
165184

166-
OverridingKind override; /* OVERRIDING clause */
185+
/* OVERRIDING clause */
186+
OverridingKind override;
167187

168188
OnConflictExpr *onConflict; /* ON CONFLICT DO [NOTHING | UPDATE] */
169189

@@ -191,20 +211,25 @@ typedef struct Query
191211
Node *setOperations; /* set-operation tree if this is top level of
192212
* a UNION/INTERSECT/EXCEPT query */
193213

194-
List *constraintDeps; /* a list of pg_constraint OIDs that the query
195-
* depends on to be semantically valid */
214+
/*
215+
* A list of pg_constraint OIDs that the query depends on to be
216+
* semantically valid
217+
*/
218+
List *constraintDeps;
196219

197-
List *withCheckOptions; /* a list of WithCheckOption's (added
198-
* during rewrite) */
220+
/* a list of WithCheckOption's (added during rewrite) */
221+
List *withCheckOptions;
199222

200223
/*
201224
* The following two fields identify the portion of the source text string
202225
* containing this query. They are typically only populated in top-level
203226
* Queries, not in sub-queries. When not set, they might both be zero, or
204227
* both be -1 meaning "unknown".
205228
*/
206-
int stmt_location; /* start location, or -1 if unknown */
207-
int stmt_len; /* length in bytes; 0 means "rest of string" */
229+
/* start location, or -1 if unknown */
230+
int stmt_location;
231+
/* length in bytes; 0 means "rest of string" */
232+
int stmt_len;
208233
} Query;
209234

210235

@@ -1231,14 +1256,21 @@ typedef struct RangeTblFunction
12311256
NodeTag type;
12321257

12331258
Node *funcexpr; /* expression tree for func call */
1234-
int funccolcount; /* number of columns it contributes to RTE */
1259+
/* number of columns it contributes to RTE */
1260+
int funccolcount;
12351261
/* These fields record the contents of a column definition list, if any: */
1236-
List *funccolnames; /* column names (list of String) */
1237-
List *funccoltypes; /* OID list of column type OIDs */
1238-
List *funccoltypmods; /* integer list of column typmods */
1239-
List *funccolcollations; /* OID list of column collation OIDs */
1262+
/* column names (list of String) */
1263+
List *funccolnames;
1264+
/* OID list of column type OIDs */
1265+
List *funccoltypes;
1266+
/* integer list of column typmods */
1267+
List *funccoltypmods;
1268+
/* OID list of column collation OIDs */
1269+
List *funccolcollations;
1270+
12401271
/* This is set during planning for use by the executor: */
1241-
Bitmapset *funcparams; /* PARAM_EXEC Param IDs affecting this func */
1272+
/* PARAM_EXEC Param IDs affecting this func */
1273+
Bitmapset *funcparams;
12421274
} RangeTblFunction;
12431275

12441276
/*
@@ -1345,7 +1377,8 @@ typedef struct SortGroupClause
13451377
Oid eqop; /* the equality operator ('=' op) */
13461378
Oid sortop; /* the ordering operator ('<' op), or 0 */
13471379
bool nulls_first; /* do NULLs come before normal values? */
1348-
bool hashable; /* can eqop be implemented by hashing? */
1380+
/* can eqop be implemented by hashing? */
1381+
bool hashable;
13491382
} SortGroupClause;
13501383

13511384
/*
@@ -1435,21 +1468,31 @@ typedef struct GroupingSet
14351468
typedef struct WindowClause
14361469
{
14371470
NodeTag type;
1438-
char *name; /* window name (NULL in an OVER clause) */
1439-
char *refname; /* referenced window name, if any */
1471+
/* window name (NULL in an OVER clause) */
1472+
char *name;
1473+
/* referenced window name, if any */
1474+
char *refname;
14401475
List *partitionClause; /* PARTITION BY list */
1441-
List *orderClause; /* ORDER BY list */
1476+
/* ORDER BY list */
1477+
List *orderClause;
14421478
int frameOptions; /* frame_clause options, see WindowDef */
14431479
Node *startOffset; /* expression for starting bound, if any */
14441480
Node *endOffset; /* expression for ending bound, if any */
1445-
List *runCondition; /* qual to help short-circuit execution */
1446-
Oid startInRangeFunc; /* in_range function for startOffset */
1447-
Oid endInRangeFunc; /* in_range function for endOffset */
1448-
Oid inRangeColl; /* collation for in_range tests */
1449-
bool inRangeAsc; /* use ASC sort order for in_range tests? */
1450-
bool inRangeNullsFirst; /* nulls sort first for in_range tests? */
1481+
/* qual to help short-circuit execution */
1482+
List *runCondition;
1483+
/* in_range function for startOffset */
1484+
Oid startInRangeFunc;
1485+
/* in_range function for endOffset */
1486+
Oid endInRangeFunc;
1487+
/* collation for in_range tests */
1488+
Oid inRangeColl;
1489+
/* use ASC sort order for in_range tests? */
1490+
bool inRangeAsc;
1491+
/* nulls sort first for in_range tests? */
1492+
bool inRangeNullsFirst;
14511493
Index winref; /* ID referenced by window functions */
1452-
bool copiedOrder; /* did we copy orderClause from refname? */
1494+
/* did we copy orderClause from refname? */
1495+
bool copiedOrder;
14531496
} WindowClause;
14541497

14551498
/*
@@ -1568,13 +1611,22 @@ typedef struct CommonTableExpr
15681611
CTECycleClause *cycle_clause;
15691612
int location; /* token location, or -1 if unknown */
15701613
/* These fields are set during parse analysis: */
1571-
bool cterecursive; /* is this CTE actually recursive? */
1572-
int cterefcount; /* number of RTEs referencing this CTE
1573-
* (excluding internal self-references) */
1574-
List *ctecolnames; /* list of output column names */
1575-
List *ctecoltypes; /* OID list of output column type OIDs */
1576-
List *ctecoltypmods; /* integer list of output column typmods */
1577-
List *ctecolcollations; /* OID list of column collation OIDs */
1614+
/* is this CTE actually recursive? */
1615+
bool cterecursive;
1616+
1617+
/*
1618+
* Number of RTEs referencing this CTE (excluding internal
1619+
* self-references)
1620+
*/
1621+
int cterefcount;
1622+
/* list of output column names */
1623+
List *ctecolnames;
1624+
/* OID list of output column type OIDs */
1625+
List *ctecoltypes;
1626+
/* integer list of output column typmods */
1627+
List *ctecoltypmods;
1628+
/* OID list of column collation OIDs */
1629+
List *ctecolcollations;
15781630
} CommonTableExpr;
15791631

15801632
/* Convenience macro to get the output tlist of a CTE's query */
@@ -1611,10 +1663,12 @@ typedef struct MergeAction
16111663
NodeTag type;
16121664
bool matched; /* true=MATCHED, false=NOT MATCHED */
16131665
CmdType commandType; /* INSERT/UPDATE/DELETE/DO NOTHING */
1614-
OverridingKind override; /* OVERRIDING clause */
1666+
/* OVERRIDING clause */
1667+
OverridingKind override;
16151668
Node *qual; /* transformed WHEN conditions */
16161669
List *targetList; /* the target list (of TargetEntry) */
1617-
List *updateColnos; /* target attribute numbers of an UPDATE */
1670+
/* target attribute numbers of an UPDATE */
1671+
List *updateColnos;
16181672
} MergeAction;
16191673

16201674
/*
@@ -1824,10 +1878,14 @@ typedef struct SetOperationStmt
18241878
/* Eventually add fields for CORRESPONDING spec here */
18251879

18261880
/* Fields derived during parse analysis: */
1827-
List *colTypes; /* OID list of output column type OIDs */
1828-
List *colTypmods; /* integer list of output column typmods */
1829-
List *colCollations; /* OID list of output column collation OIDs */
1830-
List *groupClauses; /* a list of SortGroupClause's */
1881+
/* OID list of output column type OIDs */
1882+
List *colTypes;
1883+
/* integer list of output column typmods */
1884+
List *colTypmods;
1885+
/* OID list of output column collation OIDs */
1886+
List *colCollations;
1887+
/* a list of SortGroupClause's */
1888+
List *groupClauses;
18311889
/* groupClauses is NIL if UNION ALL, but must be set otherwise */
18321890
} SetOperationStmt;
18331891

0 commit comments

Comments
 (0)