agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Seb <spluque@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: creating a new aggregate function
Date: Mon, 03 Mar 2014 19:17:55 -0500
Message-ID: <20952.1393892275@sss.pgh.pa.us> (raw)
In-Reply-To: <87lhwqu8q6.fsf@net82.ceos.umanitoba.ca>
References: <87iorvurrd.fsf@net82.ceos.umanitoba.ca>
	<1393868159887-5794419.post@n5.nabble.com>
	<87wqgbt3kf.fsf@net82.ceos.umanitoba.ca>
	<1393881121206-5794448.post@n5.nabble.com>
	<87lhwqu8q6.fsf@net82.ceos.umanitoba.ca>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Seb <spluque@gmail.com> writes:
> Thanks for that suggestion.  It seemed as if array_agg would allow me to
> define a new aggregate for avg as follows:

> CREATE AGGREGATE avg (angle_vector)
> (
>   sfunc=array_agg,
>   stype=anyarray,
>   finalfunc=angle_vector_avg
> );

That's not going to work, for exactly this reason:

> ERROR:  cannot determine transition data type
> DETAIL:  An aggregate using a polymorphic transition type must have at least one polymorphic argument.

I see no reason to use a polymorphic type here anyway ... why not just
declare the transition data type as angle_vector[] ?

			regards, tom lane


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (7+ messages)  latest in thread

Message-ID: <20952.1393892275@sss.pgh.pa.us>
Permalink:  ../20952.1393892275@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20952.1393892275@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, spluque@gmail.com
  Subject: Re: creating a new aggregate function
  In-Reply-To: <20952.1393892275@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox