|
29 | 29 | * of course). A non-strict finalfunc can make its own choice of
|
30 | 30 | * what to return for a NULL ending transvalue.
|
31 | 31 | *
|
| 32 | + * When the transvalue datatype is pass-by-reference, we have to be |
| 33 | + * careful to ensure that the values survive across tuple cycles yet |
| 34 | + * are not allowed to accumulate until end of query. We do this by |
| 35 | + * "ping-ponging" between two memory contexts; successive calls to the |
| 36 | + * transfunc are executed in alternate contexts, passing the previous |
| 37 | + * transvalue that is in the other context. At the beginning of each |
| 38 | + * tuple cycle we can reset the current output context to avoid memory |
| 39 | + * usage growth. Note: we must use MemoryContextContains() to check |
| 40 | + * whether the transfunc has perhaps handed us back one of its input |
| 41 | + * values rather than a freshly palloc'd value; if so, we copy the value |
| 42 | + * to the context we want it in. |
| 43 | + * |
32 | 44 | *
|
33 | 45 | * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
34 | 46 | * Portions Copyright (c) 1994, Regents of the University of California
|
35 | 47 | *
|
36 | 48 | * IDENTIFICATION
|
37 |
| - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.73 2001/01/24 19:42:54 momjian Exp $ |
| 49 | + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.74 2001/02/15 21:47:08 tgl Exp $ |
38 | 50 | *
|
39 | 51 | *-------------------------------------------------------------------------
|
40 | 52 | */
|
|