|
11 | 11 | * SQL aggregates. (Do not expect POSTQUEL semantics.) -- ay 2/95 |
12 | 12 | * |
13 | 13 | * IDENTIFICATION |
14 | | - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.56 1999/09/28 02:03:19 tgl Exp $ |
| 14 | + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.57 1999/10/0803:49:55 tgl Exp $ |
15 | 15 | * |
16 | 16 | *------------------------------------------------------------------------- |
17 | 17 | */ |
@@ -136,12 +136,11 @@ copyDatum(Datum val, int typLen, bool typByVal) |
136 | 136 | * sfunc1 is never applied when the current tuple's aggregated_value |
137 | 137 | * is NULL. sfunc2 is applied for each tuple if the aggref is marked |
138 | 138 | * 'usenulls', otherwise it is only applied when aggregated_value is |
139 | | - * not NULL. (usenulls is normally set only for the case of COUNT(*), |
140 | | - * since according to the SQL92 standard that is the only aggregate |
141 | | - * that considers nulls in its input. SQL92 requires COUNT(*) and |
142 | | - * COUNT(field) to behave differently --- the latter doesn't count nulls |
143 | | - * --- so we can't make this flag a column of pg_aggregate but must |
144 | | - * set it according to usage. Ugh.) |
| 139 | + * not NULL. (usenulls was formerly used for COUNT(*), but is no longer |
| 140 | + * needed for that purpose; as of 10/1999 the support for usenulls is |
| 141 | + * dead code. I have not removed it because it seems like a potentially |
| 142 | + * useful feature for user-defined aggregates. We'd just need to add a |
| 143 | + * flag column to pg_aggregate and a parameter to CREATE AGGREGATE...) |
145 | 144 | * |
146 | 145 | * If the outer subplan is a Group node, ExecAgg returns as many tuples |
147 | 146 | * as there are groups. |
@@ -534,27 +533,14 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent) |
534 | 533 | outerPlan=outerPlan(node); |
535 | 534 | ExecInitNode(outerPlan,estate, (Plan*)node); |
536 | 535 |
|
537 | | -/* |
538 | | - * Result runs in its own context, but make it use our aggregates fix |
539 | | - * for 'select sum(2+2)' |
540 | | - */ |
541 | | -if (IsA(outerPlan,Result)) |
542 | | -{ |
543 | | -((Result*)outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_aggvalues= |
544 | | -econtext->ecxt_aggvalues; |
545 | | -((Result*)outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_aggnulls= |
546 | | -econtext->ecxt_aggnulls; |
547 | | -} |
548 | | - |
549 | 536 | /* ---------------- |
550 | | - *initialize tuple type. |
| 537 | + *initializesourcetuple type. |
551 | 538 | * ---------------- |
552 | 539 | */ |
553 | 540 | ExecAssignScanTypeFromOuterPlan((Plan*)node,&aggstate->csstate); |
554 | 541 |
|
555 | 542 | /* |
556 | | - * Initialize tuple type for both result and scan. This node does no |
557 | | - * projection |
| 543 | + * Initialize result tuple type and projection info. |
558 | 544 | */ |
559 | 545 | ExecAssignResultTypeFromTL((Plan*)node,&aggstate->csstate.cstate); |
560 | 546 | ExecAssignProjectionInfo((Plan*)node,&aggstate->csstate.cstate); |
|