From: | Stephen Scheck <singularsyntax(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Set Returning Functions and array_agg() |
Date: | 2013-04-24 19:48:44 |
Message-ID: | CAKjnHz2FxGKqGRj7BNVfFTt-kxKSLGakK3xnurKRHHk3-GxkEg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have a UDF (written in C) that returns SETOF RECORD of an anonymous
record type
(defined via OUT parameters). I'm trying to use array_agg() to transform
its output to
an array:
pg_dev=# SELECT array_agg((my_setof_record_returning_func()).col1);
ERROR: set-valued function called in context that cannot accept a set
Or the alternate syntax:
pg_dev=# SELECT array_agg(col1(my_setof_record_returning_func()));
ERROR: set-valued function called in context that cannot accept a set
Can somebody explain why I get the error message? Presumably the parser is
deciding that
the expression provided to array_agg() is a set, based on
my_setof_record_returning_func()'s
definition. But shouldn't the column selection (or equivalent
column-as-func-call notation) supply
the expected context to array_agg()?
Thanks.
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2013-04-24 20:29:25 | Re: Set Returning Functions and array_agg() |
Previous Message | Alexander Reichstadt | 2013-04-24 19:19:14 | Re: DISTINCT ON changes sort order |