Re: aggregates with complex type as state and init condition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Thomas Chille" <thomas(at)chille(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: aggregates with complex type as state and init condition
Date: 2004-08-30 20:54:46
Message-ID: 11370.1093899286@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Thomas Chille" <thomas(at)chille(dot)de> writes:
> Now i tried to set the init-state to wnumeric(0, 0), but it wont work. The INITCOND-paramter only
> accept string-literals like '0, 0', '(0.0,0.0)', but if i use the agrregate i get always this:
> 'ERROR: Cannot accept a constant of type RECORD'.

This isn't going to work in existing releases, but FWIW it does work in 8.0.

Do you really need the weight and the value to be of different
datatypes? You could make it work in current releases by using
a two-element array as the state type.

BTW, as far as I can see all those functions would be better defined
as IMMUTABLE than VOLATILE.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josué Maldonado 2004-08-30 21:02:56 update trigger performance
Previous Message David Parker 2004-08-30 20:52:32 functionality like Oracle's "connect by"