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

Commite9b6482

Browse files
committed
Improve comments for execExpr.c's isAssignmentIndirectionExpr().
I got confused about why this function doesn't need to recursivelysearch the expression tree for a CaseTestExpr node. After figuringthat out, add a comment to save the next person some time.
1 parent837255c commite9b6482

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/backend/executor/execExpr.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,14 +2443,14 @@ ExecInitArrayRef(ExprEvalStep *scratch, ArrayRef *aref, PlanState *parent,
24432443
* refassgnexpr is itself a FieldStore or ArrayRef that needs to
24442444
* obtain and modify the previous value of the array element or slice
24452445
* being replaced. If so, we have to extract that value from the
2446-
* array and pass it down via theCaseTextExpr mechanism. It's safe
2446+
* array and pass it down via theCaseTestExpr mechanism. It's safe
24472447
* to reuse the CASE mechanism because there cannot be a CASE between
24482448
* here and where the value would be needed, and an array assignment
24492449
* can't be within a CASE either. (So saving and restoring
24502450
* innermost_caseval is just paranoia, but let's do it anyway.)
24512451
*
24522452
* Since fetching the old element might be a nontrivial expense, do it
2453-
* only if the argumentappears toactuallyneed it.
2453+
* only if the argument actuallyneeds it.
24542454
*/
24552455
if (isAssignmentIndirectionExpr(aref->refassgnexpr))
24562456
{
@@ -2506,10 +2506,16 @@ ExecInitArrayRef(ExprEvalStep *scratch, ArrayRef *aref, PlanState *parent,
25062506

25072507
/*
25082508
* Helper for preparing ArrayRef expressions for evaluation: is expr a nested
2509-
* FieldStore or ArrayRef thatmight need the old element value passed down?
2509+
* FieldStore or ArrayRef thatneeds the old element value passed down?
25102510
*
25112511
* (We could use this in FieldStore too, but in that case passing the old
25122512
* value is so cheap there's no need.)
2513+
*
2514+
* Note: it might seem that this needs to recurse, but it does not; the
2515+
* CaseTestExpr, if any, will be directly the arg or refexpr of the top-level
2516+
* node. Nested-assignment situations give rise to expression trees in which
2517+
* each level of assignment has its own CaseTestExpr, and the recursive
2518+
* structure appears within the newvals or refassgnexpr field.
25132519
*/
25142520
staticbool
25152521
isAssignmentIndirectionExpr(Expr*expr)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp