diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-04-24 13:01:33 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-04-24 13:01:33 -0400 |
commit | fce3b26e97ca98de054734e2af7d9125661a9b3f (patch) | |
tree | 39507a1cc4b6aac89f6143b586fc5a2d032fd3fe /src/backend/executor/nodeWindowAgg.c | |
parent | 5a8366ad75eb70cffa791119b404c897983260c6 (diff) | |
download | postgresql-fce3b26e97ca98de054734e2af7d9125661a9b3f.tar.gz |
Rename ExecAggTransReparent, and improve its documentation.
The name of this function suggests that it ought to reparent R/W
expanded objects to be children of the persistent aggcontext, instead
of copying them. In fact it does no such thing, and if you try to
make it do so you will see multiple regression failures. Rename it
to the less-misleading ExecAggCopyTransValue, and add commentary
about why that attractive-sounding optimization won't work. Also
adjust comments at call sites, some of which were describing logic
that has since been moved into ExecAggCopyTransValue.
Discussion: https://postgr.es/m/3004282.1681930251@sss.pgh.pa.us
Diffstat (limited to 'src/backend/executor/nodeWindowAgg.c')
-rw-r--r-- | src/backend/executor/nodeWindowAgg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index 3ac581a711..4f0618f27a 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -368,7 +368,8 @@ advance_windowaggregate(WindowAggState *winstate, * free the prior transValue. But if transfn returned a pointer to its * first input, we don't need to do anything. Also, if transfn returned a * pointer to a R/W expanded object that is already a child of the - * aggcontext, assume we can adopt that value without copying it. + * aggcontext, assume we can adopt that value without copying it. (See + * comments for ExecAggCopyTransValue, which this code duplicates.) */ if (!peraggstate->transtypeByVal && DatumGetPointer(newVal) != DatumGetPointer(peraggstate->transValue)) @@ -533,7 +534,8 @@ advance_windowaggregate_base(WindowAggState *winstate, * free the prior transValue. But if invtransfn returned a pointer to its * first input, we don't need to do anything. Also, if invtransfn * returned a pointer to a R/W expanded object that is already a child of - * the aggcontext, assume we can adopt that value without copying it. + * the aggcontext, assume we can adopt that value without copying it. (See + * comments for ExecAggCopyTransValue, which this code duplicates.) * * Note: the checks for null values here will never fire, but it seems * best to have this stanza look just like advance_windowaggregate. |