Re: [GENERAL] Set Returning Functions and array_agg()

2013-04-25 Thread Merlin Moncure
On Wed, Apr 24, 2013 at 4:26 PM, Stephen Scheck wrote: > Possibly due to my lack of thorough SQL understanding. Perhaps there's a > better way of doing what I'm ultimately trying to accomplish, but still the > question remains - why does this work: > > pg_dev=# select unnest(array[1,2,3]); > unne

Re: [GENERAL] Set Returning Functions and array_agg()

2013-04-25 Thread Jasen Betts
On 2013-04-24, Stephen Scheck wrote: > --f46d043c810aa794a404db21f464 > Content-Type: text/plain; charset=ISO-8859-1 > > Possibly due to my lack of thorough SQL understanding. Perhaps there's a > better way of doing what I'm ultimately trying to accomplish, but still the > question remains - why d

Re: [GENERAL] Set Returning Functions and array_agg()

2013-04-24 Thread Stephen Scheck
I'm guessing the reason is something like this: even though the "things" returned by these two statements are the same logical entity (from a mathematics/set theory standpoint): pg_dev=# select * from unnest(array[1,2,3]); unnest 1 2 3 (3 rows) pg_dev=# select unnest(a

Re: [GENERAL] Set Returning Functions and array_agg()

2013-04-24 Thread Stephen Scheck
Possibly due to my lack of thorough SQL understanding. Perhaps there's a better way of doing what I'm ultimately trying to accomplish, but still the question remains - why does this work: pg_dev=# select unnest(array[1,2,3]); unnest 1 2 3 (3 rows) But not this: pg_dev

Re: [GENERAL] Set Returning Functions and array_agg()

2013-04-24 Thread hubert depesz lubaczewski
On Wed, Apr 24, 2013 at 12:48:44PM -0700, Stephen Scheck wrote: > 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_r

[GENERAL] Set Returning Functions and array_agg()

2013-04-24 Thread Stephen Scheck
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