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.

Reply via email to