From: | Dawid Kuroczko <qnex42(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Columns into rows. |
Date: | 2005-01-13 11:31:20 |
Message-ID: | 758d5e7f0501130331546d9f6a@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 13 Jan 2005 11:45:52 +0100, Dawid Kuroczko <qnex42(at)gmail(dot)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?
From | Date | Subject | |
---|---|---|---|
Next Message | KÖPFERL Robert | 2005-01-13 11:39:46 | RE RE: Single row tables |
Previous Message | Dawid Kuroczko | 2005-01-13 10:45:52 | Re: Columns into rows. |