Re: aggregate function - Mailing list pgsql-sql

From Tom Lane
Subject Re: aggregate function
Date
Msg-id 19609.1280846905@sss.pgh.pa.us
Whole thread Raw
In response to aggregate function  (Viktor Bojović <viktor.bojovic@gmail.com>)
List pgsql-sql
Viktor Bojović <viktor.bojovic@gmail.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


pgsql-sql by date:

Previous
From: Viktor Bojović
Date:
Subject: aggregate function
Next
From: "Garrett Murphy"
Date:
Subject: Backslash characters in PLPGSQL