Re: How to solve the old bool attributes vs pivoting issue?

Samuel Gendler <sgendler@ideasculptor.com>

From: Samuel Gendler <sgendler@ideasculptor.com>
To: David Johnston <polobo@yahoo.com>
Cc: Andreas <maps.on@gmx.net>, "pgsql-sql@postgresql.org" <pgsql-sql@postgresql.org>
Date: 2012-06-28T04:16:21Z
Lists: pgsql-sql
On Wed, Jun 27, 2012 at 7:26 PM, David Johnston <polobo@yahoo.com> wrote:

> On Jun 27, 2012, at 21:07, Andreas <maps.on@gmx.net> wrote:
>
>
> You should look and see whether the hstore contrib module will meet your
> needs.
>
> http://www.postgresql.org/docs/9.1/interactive/hstore.html
>
>
hstore is certainly an option, as are the crosstab functions in the
tablefunc contrib module, which can definitely do what you are looking for.
 The 2-query form of the function would allow you to generate a resultset
that gives true/false/null for every possible attribute without having to
have a column for every attribute, yet you'd have all of the convenience of
a normalized schema representing attributes when doing other queries. There
are a fair number of threads about using the crosstab functions in the
archives of this list.

--sam