Re: Best practice on inherited tables

From: Julian <tempura(at)internode(dot)on(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Best practice on inherited tables
Date: 2013-05-19 02:43:09
Message-ID: 51983C3D.40908@internode.on.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 17/05/13 22:46, Frank Lanitz wrote:
> Hi folkes,
>
> I'm looking for a nice way to build this scenario:
> I've got a lot of locations with some special types. For example I've
> got workplaces, places like real laboratories and virtual places like
> maybe parcel service. For each of the different types I need to store
> some common attributes as well as some special ones. Having OOP in mind
> I came to the point of inherit tables. so I've create something like
> that (just a minimal example):
>
> CREATE TABLE locations(
> id SERIAL PRIMARY KEY,
> name varchar(50)
> );
> CREATE TABLE workplaces(
> workers integer
> ) INHERITS (locations);
>
Hi,
Wouldn't you prefer something like locations, workers, worker_locations
table schemas?
INHERITS is a feature, but you have to be careful and differentiate for
when it is actually useful. It can bring up debate involving OOP
practices transfered over into general database design. For which I
quash with:

database design != application design

How you store data should be irrelevant to application interfaces
(API's). People do it and some frameworks encourage it.

Regards,
Julian.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2013-05-19 03:02:31 Re: Best practice on inherited tables
Previous Message S H 2013-05-19 01:13:57 Re: Vacuum problem