Skip site navigation (1) Skip section navigation (2)

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

From: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: Andreas <maps(dot)on(at)gmx(dot)net>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to solve the old bool attributes vs pivoting issue?
Date: 2012-06-28 04:16:21
Message-ID: CAEV0TzAB8bqGky1mWX5mOUjpQ53suOg1gYgDiCY0Zc=9tDtQXQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Wed, Jun 27, 2012 at 7:26 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:

> On Jun 27, 2012, at 21:07, Andreas <maps(dot)on(at)gmx(dot)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

In response to

pgsql-sql by date

Next:From: George WoodringDate: 2012-06-29 20:02:47
Subject: must appear in GROUP by clause issue
Previous:From: David JohnstonDate: 2012-06-28 02:26:52
Subject: Re: How to solve the old bool attributes vs pivoting issue?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group