Re: aggregate function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Viktor Bojović <viktor(dot)bojovic(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: aggregate function
Date: 2010-08-03 14:48:25
Message-ID: 19609.1280846905@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

=?UTF-8?Q?Viktor_Bojovi=C4=87?= <viktor(dot)bojovic(at)gmail(dot)com> writes:
> I tried to write this part below, but something is wrong (ERROR: function
> grafika.pov_sphere(character varying, numeric, numeric, numeric, numeric,
> character varying) does not exist) so I wanted to ask if someone knows how
> to solve this problem.

Well, it's right: you didn't create such a function. The aggregate
transition function has to take the state datatype as its first
argument. You can't just plug these two randomly-chosen functions
into an aggregate definition and expect the system to intuit what you
want done. I think what you actually need is a transition function
that works something like

if ($1 is null)
return agg_pov_sphere($2,$3,...);
else
return concat($1, agg_pov_sphere($2,$3,...));

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Garrett Murphy 2010-08-03 15:05:39 Backslash characters in PLPGSQL
Previous Message Viktor Bojović 2010-08-03 14:38:51 aggregate function