Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA23335; Mon, 10 Aug 92 23:54:23 -0700
Date: Mon, 10 Aug 92 23:54:23 -0700
Message-Id: <9208110654.AA23335@postgres.Berkeley.EDU>
From: clh@tfic.bc.ca (Chris Hermansen )
Subject: Re: v4 announcement
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu


Ahem.  May I start by apologizing for still trying to use V3.0?

Also, may I apologize in advance of asking what's probably a really dumb
question?

Having got all that off my chest, I was trying to use some aggregates today
(aggregates SUM and AVG come to mind), and after much flailing, noted that
they don't seem to be defined in my system.  The symptoms are thus:

* retrieve (xx = avg {TallyTrees.dbh}) \g

Query sent to backend is "retrieve (xx = avg {TallyTrees.dbh}) "
WARN:Aug 10 14:36:28:aggregate avg does not exist
 

Go 
*

Browsing the system catalogs gives

* retrieve (pg_aggregate.all) \g

Query sent to backend is "retrieve (pg_aggregate.all) "
-----------------------------------------------------------------------------------------------------------------
| aggname     | xitionfunc1 | xitionfunc2 | finalfunc   | inttype     | fintype     | initaggval  | initsecval  |
-----------------------------------------------------------------------------------------------------------------
| int4ave     | int4pl      | int4inc     | int4div     | 23          | 23          | 0           | 0           |
-----------------------------------------------------------------------------------------------------------------
| int2ave     | int2pl      | int2inc     | int2div     | 21          | 21          | 0           | 0           |
-----------------------------------------------------------------------------------------------------------------

Go 
* 

I interpret this to mean that there are only two aggregates currently defined:
one for int4's, the other for int2's, and that they probably only do averaging.

Peering about further, I note that there are PG_PROCs with PRONAMEs of
float8pl and float8div, but not float8inc.  Is this a clue, or just
::red_herring?

What's more, I note in checking the file ~postgres/files/local1_template1.bki
that, sure enough, I only see:

open pg_aggregate
insert OID = 1028 ( int4ave int4pl int4inc int4div 23 23 0 0)
insert OID = 1029 ( int2ave int2pl int2inc int2div 21 21 0 0)
show
close pg_aggregate


The "DEFINE AGGREGATE" manual page leaves a bit too much to my (relatively
thin) imagination; am I missing something obvious?  In particular, can one
"overload" aggregate definitions, thereby allowing use of aggregate names
like "sum" and "avg", irrespective of data types?

Your attention is much appreciated.  Thanks.

Chris Hermansen                         Timberline Forest Inventory Consultants
Voice: 1 604 733 0731                   302 - 958 West 8th Avenue
FAX:   1 604 733 0634                   Vancouver B.C. CANADA
clh@tfic.bc.ca                          V5Z 1E5

C'est ma facon de parler.
