Re: How to solve the old bool attributes vs pivoting issue? - Mailing list pgsql-sql

From Samuel Gendler
Subject Re: How to solve the old bool attributes vs pivoting issue?
Date
Msg-id CAEV0TzAB8bqGky1mWX5mOUjpQ53suOg1gYgDiCY0Zc=9tDtQXQ@mail.gmail.com
Whole thread Raw
In response to Re: How to solve the old bool attributes vs pivoting issue?  (David Johnston <polobo@yahoo.com>)
List 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

pgsql-sql by date:

Previous
From: David Johnston
Date:
Subject: Re: How to solve the old bool attributes vs pivoting issue?
Next
From: George Woodring
Date:
Subject: must appear in GROUP by clause issue