Re: Columns into rows.
От | Dawid Kuroczko |
---|---|
Тема | Re: Columns into rows. |
Дата | |
Msg-id | 758d5e7f0501130331546d9f6a@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Columns into rows. (Dawid Kuroczko <qnex42@gmail.com>) |
Список | pgsql-sql |
On Thu, 13 Jan 2005 11:45:52 +0100, Dawid Kuroczko <qnex42@gmail.com> wrote: > > SELECT * FROM (SELECT id, path AS path_a FROM new_table_paths WHERE > > pathtype = 'a') AS a NATURAL FULL OUTER JOIN (SELECT id, path AS > > path_bb FROM new_table_paths WHERE pathtype = 'bb') AS bb WHERE id = > > <<NUM>>; Part of the problem solved: CREATE AGGREGATE array_aggregate (basetype = anyelement, sfunc = array_append, stype = anyarray, initcond = '{}'); SELECT id,array_aggregate(pathtype||'='||path) from new_table_paths group by id; I.e. have a nice array of type=value pairs. I have however failed to write a function which would take text[] and return columns. I tried using RETURN record type, but so far it does not return anything useful (just a parenthesis enclosed list of column values). Any hints?
В списке pgsql-sql по дате отправления: