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

Commitde2af6e

Browse files
committed
Improve comments for execExpr.c's handling of FieldStore subexpressions.
Given this code's general eagerness to use subexpressions' output variablesas temporary workspace, it's not exactly clear that it is safe forFieldStore to tell a newval subexpression that it can write into the samevariable that is being supplied as a potential input. Document the chainof assumptions needed for that to be safe.
1 parente9b6482 commitde2af6e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎src/backend/executor/execExpr.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,18 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state,
11161116
* field assignment can't be within a CASE either. (So
11171117
* saving and restoring innermost_caseval is just
11181118
* paranoia, but let's do it anyway.)
1119+
*
1120+
* Another non-obvious point is that it's safe to use the
1121+
* field's values[]/nulls[] entries as both the caseval
1122+
* source and the result address for this subexpression.
1123+
* That's okay only because (1) both FieldStore and
1124+
* ArrayRef evaluate their arg or refexpr inputs first,
1125+
* and (2) any such CaseTestExpr is directly the arg or
1126+
* refexpr input. So any read of the caseval will occur
1127+
* before there's a chance to overwrite it. Also, if
1128+
* multiple entries in the newvals/fieldnums lists target
1129+
* the same field, they'll effectively be applied
1130+
* left-to-right which is what we want.
11191131
*/
11201132
save_innermost_caseval=state->innermost_caseval;
11211133
save_innermost_casenull=state->innermost_casenull;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp