From: Dawid Kuroczko <qnex42@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Columns into rows.
Date: Thu, 13 Jan 2005 12:31:20 +0100
Message-ID: <758d5e7f0501130331546d9f6a@mail.gmail.com> (raw)
In-Reply-To: <758d5e7f0501130245e2e6fb1@mail.gmail.com>
References: <758d5e7f05011302265be7e12a@mail.gmail.com>
<758d5e7f0501130245e2e6fb1@mail.gmail.com>
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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: qnex42@gmail.com
Subject: Re: Columns into rows.
In-Reply-To: <758d5e7f0501130331546d9f6a@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox