Re: [Plproxy-users] A complex plproxy query - Mailing list pgsql-general

From Igor Katson
Subject Re: [Plproxy-users] A complex plproxy query
Date
Msg-id 4978860E.1000006@gmail.com
Whole thread Raw
In response to Re: [Plproxy-users] A complex plproxy query  (Hannu Krosing <hannu@2ndQuadrant.com>)
List pgsql-general
Hannu Krosing wrote:
> On Thu, 2009-01-22 at 16:13 +0200, Hannu Krosing wrote:
>
>> On Thu, 2009-01-22 at 15:10 +0300, Igor Katson wrote:
>>
>>
>>> Ok, thank you, guys. What is the best way to make an array out of a
>>> column? I didn't make up anything better then writing a function:
>>>
>>> CREATE OR REPLACE FUNCTION int_column_to_array(query text) RETURNS int[]
>>> AS $$
>>>     DECLARE
>>>         arr int[];
>>>         rec int;
>>>     BEGIN
>>>         FOR rec IN EXECUTE query
>>>         LOOP
>>>             arr := array_append('{}',rec);
>>>         END LOOP;
>>>         RETURN arr;
>>>     END;
>>> $$ language plpgsql;
>>>
>> hannu=# select ARRAY(select usename from pg_user);
>>            ?column?
>> -------------------------------
>>  {postgres,hannu,m1,skyncuser}
>> (1 row)
>>
>
> So what yo need is
>
> select * from
> gather_friend_info_from_all_partitions(get_friend_id_list_form_user_partition(user_id));
>
>
Yes, after using arrays, I figured out perfectly, how to do that. And
thanks for the help!

pgsql-general by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: [Plproxy-users] A complex plproxy query
Next
From: "Marc Mamin"
Date:
Subject: Re: Slow update