Re: Type inheritance

From: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
To: Gianvito Pio <pio(dot)gianvito(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Type inheritance
Date: 2009-06-06 14:30:57
Message-ID: 396486430906060730t1afd39a9p49b056158b1d2194@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Jun 6, 2009 at 12:10 AM, Gianvito Pio<pio(dot)gianvito(at)gmail(dot)com> wrote:

> That value doesn't have to be fixed, but I want to define it in a
> way that it changes its structure when the sensor type changes. For
> example, for Temperature sensor I would like to have just a float number,
> but for the humidity I could need of absolute and relative humidity
> (2 floats). I'd just like to know if I can say that the VALUE is a composite
> type...that I have then to specialize in Temp Type and Humidity type...using
> them in their particular case.

I think that best solution for what you want to achieve is to design
you own vertically partitioned table hierarchy. PostgreSQL's table
inheritance isn't going to allow that relationships that you may want
between the sub-types.

Another PostgreSQL specific feature that allows for hierarchical data
is the contrib module h-store. Its kind-of like EAV for a column
instead of a table.

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2009-06-06 15:11:12 Re: Type inheritance
Previous Message Gianvito Pio 2009-06-06 14:18:57 Re: Type inheritance