Commit Graph

8 Commits

Author SHA1 Message Date
Marc G. Fournier 9d5c0af586 From: Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>
Subject: [HACKERS] Aggregate function patches

Here are the aggregate function patches I originally sent in last December.
They fix sum() and avg() behavior for ints and floats when NULL values are
involved.

I was waiting to resubmit these until I had a chance to write a v6.0->v6.1
database upgrade script to ensure that existing v6.0 databases which have
not been reloaded for v6.1 do no break with the new aggregate behavior.
These scripts are included below. It's OK with me if someone wants to do
something different with the upgrade strategy, but something like this
was discussed a few weeks ago.

Also, there were a couple of small items which cropped up in doing a clean
install of 970403 (actually 970402 + 970403 changes since the full 970403
tar file appears to be damaged or at least suspect). They are the first
two patches below and can be omitted if desired (although I think they
aren't dangerous :).
1997-04-03 19:56:47 +00:00
Bryan Henderson d6c06feb18 Add cast to quiet compiler warning. 1996-12-23 08:39:27 +00:00
Bruce Momjian 1eae8e1228 Fix compiler warning about unitialized variables. 1996-12-01 19:48:39 +00:00
Bruce Momjian f0a9e64afd As someone asked for this feature - patch for 1.09 follows.
Now You can do queries like

select sum(some_func(x)) from ...
select min(table1.x + table2.y) from table1, table2 where ...

and so on.

Vadim
1996-11-30 17:49:02 +00:00
Marc G. Fournier ce4c0ce1de Some compile failure fixes from Keith Parks <emkxp01@mtcc.demon.co.uk> 1996-11-06 06:52:23 +00:00
Marc G. Fournier 3df33180a1 add #include "postgres.h", as required by all .c files 1996-10-31 10:12:26 +00:00
Marc G. Fournier e152661200 Fixes:
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
1996-10-24 06:32:01 +00:00
Marc G. Fournier d31084e9d1 Postgres95 1.01 Distribution - Virgin Sources 1996-07-09 06:22:35 +00:00