Re: PostgreSQL documentation specifies 2-element array for float8_accum but 3-element array expected

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Disc Magnet <discmagnet(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL documentation specifies 2-element array for float8_accum but 3-element array expected
Date: 2011-03-23 14:41:15
Message-ID: 26511.1300891275@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Disc Magnet <discmagnet(at)gmail(dot)com> writes:
> CREATE AGGREGATE myavg(float8) (
> sfunc = float8_accum,
> stype = float8[],
> finalfunc = float8_avg,
> initcond = '{0,0}'
> );

> On trying to run this, I get this error:

> cdb=# select myavg(value) from numbers;
> ERROR: float8_accum: expected 3-element float8 array

Hm, it looks like that example has been wrong from day one ---
float8_accum has expected a 3-element array for its entire existence.
I thought maybe the code and docs had gotten out of sync later, but
AFAICS this was a thinko in the original commit. Should say
initcond = '{0,0,0}'

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Davenport, Julie 2011-03-23 14:44:31 Re: query taking much longer since Postgres 8.4 upgrade
Previous Message salah jubeh 2011-03-23 14:29:12 Re: General question