Re: Function accepting array of complex type

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function accepting array of complex type
Date: 2015-08-26 16:15:48
Message-ID: 55DDE634.5080906@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/25/2015 06:21 PM, Jim Nasby wrote:
> CREATE FUNCTION magsum( c c[] ) RETURNS float LANGUAGE sql AS $$
> SELECT sum(sqrt(c.r^2 + c.i^2)) FROM unnest(c) c
> $$;
> SELECT magsum( array[row(2.1, 2.1), row(2.2,2.2)] );

SELECT magsum( array[row(2.1, 2.1), row(2.2,2.2)]::c[] );

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2015-08-26 16:20:21 Re: WIP: Rework access method interface
Previous Message Tom Lane 2015-08-26 16:11:20 Re: 9.4 broken on alpha