Re: Columns into rows. - Mailing list pgsql-sql

From Dawid Kuroczko
Subject Re: Columns into rows.
Date
Msg-id 758d5e7f0501130331546d9f6a@mail.gmail.com
Whole thread Raw
In response to Re: Columns into rows.  (Dawid Kuroczko <qnex42@gmail.com>)
List 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 by date:

Previous
From: Dawid Kuroczko
Date:
Subject: Re: Columns into rows.
Next
From: KÖPFERL Robert
Date:
Subject: RE RE: Single row tables