@@ -2443,14 +2443,14 @@ ExecInitArrayRef(ExprEvalStep *scratch, ArrayRef *aref, PlanState *parent,
2443
2443
* refassgnexpr is itself a FieldStore or ArrayRef that needs to
2444
2444
* obtain and modify the previous value of the array element or slice
2445
2445
* being replaced. If so, we have to extract that value from the
2446
- * array and pass it down via the CaseTextExpr mechanism. It's safe
2446
+ * array and pass it down via the CaseTestExpr mechanism. It's safe
2447
2447
* to reuse the CASE mechanism because there cannot be a CASE between
2448
2448
* here and where the value would be needed, and an array assignment
2449
2449
* can't be within a CASE either. (So saving and restoring
2450
2450
* innermost_caseval is just paranoia, but let's do it anyway.)
2451
2451
*
2452
2452
* Since fetching the old element might be a nontrivial expense, do it
2453
- * only if the argument appears to actually need it.
2453
+ * only if the argument actually needs it.
2454
2454
*/
2455
2455
if (isAssignmentIndirectionExpr (aref -> refassgnexpr ))
2456
2456
{
@@ -2506,10 +2506,16 @@ ExecInitArrayRef(ExprEvalStep *scratch, ArrayRef *aref, PlanState *parent,
2506
2506
2507
2507
/*
2508
2508
* Helper for preparing ArrayRef expressions for evaluation: is expr a nested
2509
- * FieldStore or ArrayRef that might need the old element value passed down?
2509
+ * FieldStore or ArrayRef that needs the old element value passed down?
2510
2510
*
2511
2511
* (We could use this in FieldStore too, but in that case passing the old
2512
2512
* 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.
2513
2519
*/
2514
2520
static bool
2515
2521
isAssignmentIndirectionExpr (Expr * expr )
0 commit comments