pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Viktor Bojović <viktor.bojovic@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: aggregate function
Date: Tue, 03 Aug 2010 10:48:25 -0400
Message-ID: <19609.1280846905@sss.pgh.pa.us> (raw)
In-Reply-To: <AANLkTimo+SiM1VKiNM5V9tO4YMewn9+EoGV6NdJOpx+3@mail.gmail.com>
References: <AANLkTimo+SiM1VKiNM5V9tO4YMewn9+EoGV6NdJOpx+3@mail.gmail.com>

=?UTF-8?Q?Viktor_Bojovi=C4=87?= <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



view thread (2+ messages)

Message-ID: <19609.1280846905@sss.pgh.pa.us>
Permalink:  ../19609.1280846905@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19609.1280846905@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, viktor.bojovic@gmail.com
  Subject: Re: aggregate function
  In-Reply-To: <19609.1280846905@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox