Re: Function accepting array of complex type - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Function accepting array of complex type
Date
Msg-id 55DDE634.5080906@dunslane.net
Whole thread Raw
In response to Function accepting array of complex type  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 9.4 broken on alpha
Next
From: Alexander Korotkov
Date:
Subject: Re: WIP: Rework access method interface