@@ -123,47 +123,67 @@ typedef struct Query
123
123
124
124
CmdType commandType ; /* select|insert|update|delete|merge|utility */
125
125
126
- QuerySource querySource ; /* where did I come from? */
126
+ /* where did I come from? */
127
+ QuerySource querySource ;
127
128
128
129
/*
129
130
* query identifier (can be set by plugins); ignored for equal, as it
130
131
* might not be set; also not stored
131
132
*/
132
133
uint64 queryId pg_node_attr (equal_ignore , read_write_ignore , read_as (0 ));
133
134
134
- bool canSetTag ; /* do I set the command result tag? */
135
+ /* do I set the command result tag? */
136
+ bool canSetTag ;
135
137
136
138
Node * utilityStmt ; /* non-null if commandType == CMD_UTILITY */
137
139
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 ;
152
166
153
167
List * cteList ; /* WITH list (of CommonTableExpr's) */
154
168
155
169
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 ;
158
176
FromExpr * jointree ; /* table join tree (FROM and WHERE clauses);
159
177
* also USING clause for MERGE */
160
178
161
179
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 ;
163
182
164
183
List * targetList ; /* target list (of TargetEntry) */
165
184
166
- OverridingKind override ; /* OVERRIDING clause */
185
+ /* OVERRIDING clause */
186
+ OverridingKind override ;
167
187
168
188
OnConflictExpr * onConflict ; /* ON CONFLICT DO [NOTHING | UPDATE] */
169
189
@@ -191,20 +211,25 @@ typedef struct Query
191
211
Node * setOperations ; /* set-operation tree if this is top level of
192
212
* a UNION/INTERSECT/EXCEPT query */
193
213
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 ;
196
219
197
- List * withCheckOptions ; /* a list of WithCheckOption's (added
198
- * during rewrite) */
220
+ /* a list of WithCheckOption's (added during rewrite) */
221
+ List * withCheckOptions ;
199
222
200
223
/*
201
224
* The following two fields identify the portion of the source text string
202
225
* containing this query. They are typically only populated in top-level
203
226
* Queries, not in sub-queries. When not set, they might both be zero, or
204
227
* both be -1 meaning "unknown".
205
228
*/
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 ;
208
233
} Query ;
209
234
210
235
@@ -1231,14 +1256,21 @@ typedef struct RangeTblFunction
1231
1256
NodeTag type ;
1232
1257
1233
1258
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 ;
1235
1261
/* 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
+
1240
1271
/* 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 ;
1242
1274
} RangeTblFunction ;
1243
1275
1244
1276
/*
@@ -1345,7 +1377,8 @@ typedef struct SortGroupClause
1345
1377
Oid eqop ; /* the equality operator ('=' op) */
1346
1378
Oid sortop ; /* the ordering operator ('<' op), or 0 */
1347
1379
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 ;
1349
1382
} SortGroupClause ;
1350
1383
1351
1384
/*
@@ -1435,21 +1468,31 @@ typedef struct GroupingSet
1435
1468
typedef struct WindowClause
1436
1469
{
1437
1470
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 ;
1440
1475
List * partitionClause ; /* PARTITION BY list */
1441
- List * orderClause ; /* ORDER BY list */
1476
+ /* ORDER BY list */
1477
+ List * orderClause ;
1442
1478
int frameOptions ; /* frame_clause options, see WindowDef */
1443
1479
Node * startOffset ; /* expression for starting bound, if any */
1444
1480
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 ;
1451
1493
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 ;
1453
1496
} WindowClause ;
1454
1497
1455
1498
/*
@@ -1568,13 +1611,22 @@ typedef struct CommonTableExpr
1568
1611
CTECycleClause * cycle_clause ;
1569
1612
int location ; /* token location, or -1 if unknown */
1570
1613
/* 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 ;
1578
1630
} CommonTableExpr ;
1579
1631
1580
1632
/* Convenience macro to get the output tlist of a CTE's query */
@@ -1611,10 +1663,12 @@ typedef struct MergeAction
1611
1663
NodeTag type ;
1612
1664
bool matched ; /* true=MATCHED, false=NOT MATCHED */
1613
1665
CmdType commandType ; /* INSERT/UPDATE/DELETE/DO NOTHING */
1614
- OverridingKind override ; /* OVERRIDING clause */
1666
+ /* OVERRIDING clause */
1667
+ OverridingKind override ;
1615
1668
Node * qual ; /* transformed WHEN conditions */
1616
1669
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 ;
1618
1672
} MergeAction ;
1619
1673
1620
1674
/*
@@ -1824,10 +1878,14 @@ typedef struct SetOperationStmt
1824
1878
/* Eventually add fields for CORRESPONDING spec here */
1825
1879
1826
1880
/* 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 ;
1831
1889
/* groupClauses is NIL if UNION ALL, but must be set otherwise */
1832
1890
} SetOperationStmt ;
1833
1891
0 commit comments