Re: [Plproxy-users] A complex plproxy query
| От | Hannu Krosing |
|---|---|
| Тема | Re: [Plproxy-users] A complex plproxy query |
| Дата | |
| Msg-id | 1232633625.8196.1.camel@huvostro обсуждение исходный текст |
| Ответ на | Re: [Plproxy-users] A complex plproxy query (Igor Katson <descentspb@gmail.com>) |
| Ответы |
Re: [Plproxy-users] A complex plproxy query
Re: [Plproxy-users] A complex plproxy query |
| Список | pgsql-general |
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)
--
------------------------------------------
Hannu Krosing http://www.2ndQuadrant.com
PostgreSQL Scalability and Availability
Services, Consulting and Training
В списке pgsql-general по дате отправления: