]> granicus.if.org Git - postgresql/commitdiff
Fixes:
authorMarc G. Fournier <scrappy@hub.org>
Thu, 24 Oct 1996 06:32:01 +0000 (06:32 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Thu, 24 Oct 1996 06:32:01 +0000 (06:32 +0000)
It's bug in nodeAgg.c on lines 241, 242:

                null_array = malloc(nagg);
                for (i=0;i<nagg;i++)
                    null_array[i] = 'n';
                oneTuple = heap_formtuple(tupType, tupValue, null_array);

- your query has not only aggregates but also 'group by-ed' fields and so
null_array should contain tupType->natts elements (tupType->natts > nagg in
your case).

Patch follows and it's very simple.

VAdim

src/backend/executor/nodeAgg.c

index ee187367c7410e56bfbba4aa3ba92cfdc6b2219b..94764bfa3accde266d2c830910cb57a5c6074560 100644 (file)
@@ -238,8 +238,8 @@ ExecAgg(Agg *node)
                tupValue =      projInfo->pi_tupValue;
                
                /* initially, set all the values to NULL */
-               null_array = malloc(nagg);
-               for (i=0;i<nagg;i++)
+               null_array = malloc(tupType->natts);
+               for (i=0;i<tupType->natts;i++)
                    null_array[i] = 'n';
                oneTuple = heap_formtuple(tupType, tupValue, null_array);
                free(null_array);