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

Commit3c40594

Browse files
committed
Improve documentation of struct ParseState.
I got annoyed about how some fields of ParseState were documented in thestruct's block comment and some weren't; not all of the latter are trivial.Fix that. Also reorder a couple of fields that seem to have been placedrather randomly, or maybe with an idea of avoiding padding space; but thereare never so many ParseStates in existence at one time that we ought tovalue pad space over readability.
1 parent9b815a8 commit3c40594

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

‎src/include/parser/parse_node.h

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ typedef enum ParseExprKind
6565
EXPR_KIND_EXECUTE_PARAMETER,/* parameter value in EXECUTE */
6666
EXPR_KIND_TRIGGER_WHEN,/* WHEN condition in CREATE TRIGGER */
6767
EXPR_KIND_POLICY,/* USING or WITH CHECK expr in policy */
68-
EXPR_KIND_PARTITION_EXPRESSION/* PARTITION BY expression */
68+
EXPR_KIND_PARTITION_EXPRESSION/* PARTITION BY expression */
6969
}ParseExprKind;
7070

7171

@@ -123,11 +123,42 @@ typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param,
123123
* p_parent_cte: CommonTableExpr that immediately contains the current query,
124124
* if any.
125125
*
126+
* p_target_relation: target relation, if query is INSERT, UPDATE, or DELETE.
127+
*
128+
* p_target_rangetblentry: target relation's entry in the rtable list.
129+
*
130+
* p_is_insert: true to process assignment expressions like INSERT, false
131+
* to process them like UPDATE. (Note this can change intra-statement, for
132+
* cases like INSERT ON CONFLICT UPDATE.)
133+
*
126134
* p_windowdefs: list of WindowDefs representing WINDOW and OVER clauses.
127135
* We collect these while transforming expressions and then transform them
128136
* afterwards (so that any resjunk tlist items needed for the sort/group
129137
* clauses end up at the end of the query tlist). A WindowDef's location in
130138
* this list, counting from 1, is the winref number to use to reference it.
139+
*
140+
* p_expr_kind: kind of expression we're currently parsing, as per enum above;
141+
* EXPR_KIND_NONE when not in an expression.
142+
*
143+
* p_next_resno: next TargetEntry.resno to assign, starting from 1.
144+
*
145+
* p_multiassign_exprs: partially-processed MultiAssignRef source expressions.
146+
*
147+
* p_locking_clause: query's FOR UPDATE/FOR SHARE clause, if any.
148+
*
149+
* p_locked_from_parent: true if parent query level applies FOR UPDATE/SHARE
150+
* to this subquery as a whole.
151+
*
152+
* p_value_substitute: replacement for VALUE references, if we're parsing
153+
* a domain CHECK constraint.
154+
*
155+
* p_hasAggs, p_hasWindowFuncs, etc: true if we've found any of the indicated
156+
* constructs in the query.
157+
*
158+
* p_pre_columnref_hook, etc: optional parser hook functions for modifying the
159+
* interpretation of ColumnRefs and ParamRefs.
160+
*
161+
* p_ref_hook_state: passthrough state for the parser hook functions.
131162
*/
132163
structParseState
133164
{
@@ -143,21 +174,24 @@ struct ParseState
143174
List*p_ctenamespace;/* current namespace for common table exprs */
144175
List*p_future_ctes;/* common table exprs not yet in namespace */
145176
CommonTableExpr*p_parent_cte;/* this query's containing CTE */
177+
Relationp_target_relation;/* INSERT/UPDATE/DELETE target rel */
178+
RangeTblEntry*p_target_rangetblentry;/* target rel's RTE */
179+
boolp_is_insert;/* process assignment like INSERT not UPDATE */
146180
List*p_windowdefs;/* raw representations of window clauses */
147181
ParseExprKindp_expr_kind;/* what kind of expression we're parsing */
148182
intp_next_resno;/* next targetlist resno to assign */
149183
List*p_multiassign_exprs;/* junk tlist entries for multiassign */
150184
List*p_locking_clause;/* raw FOR UPDATE/FOR SHARE info */
185+
boolp_locked_from_parent;/* parent has marked this subquery
186+
* with FOR UPDATE/FOR SHARE */
151187
Node*p_value_substitute;/* what to replace VALUE with, if any */
188+
189+
/* Flags telling about things found in the query: */
152190
boolp_hasAggs;
153191
boolp_hasWindowFuncs;
154192
boolp_hasTargetSRFs;
155193
boolp_hasSubLinks;
156194
boolp_hasModifyingCTE;
157-
boolp_is_insert;
158-
boolp_locked_from_parent;
159-
Relationp_target_relation;
160-
RangeTblEntry*p_target_rangetblentry;
161195

162196
/*
163197
* Optional hook functions for parser callbacks. These are null unless

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp