mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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 :).
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_aggregate.h,v 1.4 1997/04/02 18:36:09 scrappy Exp $
|
||||
* $Id: pg_aggregate.h,v 1.5 1997/04/03 19:56:19 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* the genbki.sh script reads this file and generates .bki
|
||||
@@ -19,7 +19,7 @@
|
||||
#define PG_AGGREGATE_H
|
||||
|
||||
/* ----------------
|
||||
* postgres.h contains the system type definintions and the
|
||||
* postgres.h contains the system type definitions and the
|
||||
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
|
||||
* can be read by both genbki.sh and the C compiler.
|
||||
* ----------------
|
||||
@@ -87,15 +87,15 @@ typedef FormData_pg_aggregate *Form_pg_aggregate;
|
||||
* ---------------
|
||||
*/
|
||||
|
||||
DATA(insert OID = 0 ( avg PGUID int4pl int4inc int4div 23 23 23 23 0 0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID int2pl int2inc int2div 21 21 21 21 0 0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID float4pl float4inc float4div 700 700 700 700 0.0 0.0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID float8pl float8inc float8div 701 701 701 701 0.0 0.0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID int4pl int4inc int4div 23 23 23 23 _null_ 0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID int2pl int2inc int2div 21 21 21 21 _null_ 0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID float4pl float4inc float4div 700 700 700 700 _null_ 0.0 ));
|
||||
DATA(insert OID = 0 ( avg PGUID float8pl float8inc float8div 701 701 701 701 _null_ 0.0 ));
|
||||
|
||||
DATA(insert OID = 0 ( sum PGUID int4pl - - 23 23 0 23 0 _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID int2pl - - 21 21 0 21 0 _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID float4pl - - 700 700 0 700 0.0 _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID float8pl - - 701 701 0 701 0.0 _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID int4pl - - 23 23 0 23 _null_ _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID int2pl - - 21 21 0 21 _null_ _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID float4pl - - 700 700 0 700 _null_ _null_ ));
|
||||
DATA(insert OID = 0 ( sum PGUID float8pl - - 701 701 0 701 _null_ _null_ ));
|
||||
|
||||
DATA(insert OID = 0 ( max PGUID int4larger - - 23 23 0 23 _null_ _null_ ));
|
||||
DATA(insert OID = 0 ( max PGUID int2larger - - 21 21 0 21 _null_ _null_ ));
|
||||
@@ -113,10 +113,10 @@ DATA(insert OID = 0 ( min PGUID int4smaller - - 702 702 0 702 _null_ _nul
|
||||
DATA(insert OID = 0 ( min PGUID date_smaller - - 1082 1082 0 1082 _null_ _null_ ));
|
||||
DATA(insert OID = 0 ( min PGUID float8smaller - - 1084 1084 0 1084 _null_ _null_ ));
|
||||
|
||||
DATA(insert OID = 0 ( count PGUID - int4inc - 0 0 23 23 _null_ 0 ));
|
||||
DATA(insert OID = 0 ( count PGUID - int4inc - 0 0 23 23 _null_ 0 ));
|
||||
|
||||
/*
|
||||
* prototypes for fucnctions in pg_aggregate.c
|
||||
* prototypes for functions in pg_aggregate.c
|
||||
*/
|
||||
extern void AggregateCreate(char *aggName,
|
||||
char *aggtransfn1Name,
|
||||
@@ -131,7 +131,3 @@ extern char *AggNameGetInitVal(char *aggName, Oid basetype,
|
||||
int xfuncno, bool *isNull);
|
||||
|
||||
#endif /* PG_AGGREGATE_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user