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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers