Search Postgresql Archives

Set Returning Functions and array_agg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux