Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WKd3Y-0007kp-W1 for pgsql-sql@arkaria.postgresql.org; Tue, 04 Mar 2014 00:18:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WKd3Y-0001wn-EW for pgsql-sql@arkaria.postgresql.org; Tue, 04 Mar 2014 00:18:00 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WKd3X-0001wh-OE for pgsql-sql@postgresql.org; Tue, 04 Mar 2014 00:17:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WKd3V-0001ZF-GP for pgsql-sql@postgresql.org; Tue, 04 Mar 2014 00:17:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s240HtR5020953; Mon, 3 Mar 2014 19:17:55 -0500 From: Tom Lane To: Seb cc: pgsql-sql@postgresql.org Subject: Re: creating a new aggregate function 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> Comments: In-reply-to Seb message dated "Mon, 03 Mar 2014 18:07:45 -0600" Date: Mon, 03 Mar 2014 19:17:55 -0500 Message-ID: <20952.1393892275@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Seb 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