Re: Any reason not to use inheritance?

From: "Vidyasagara Guntaka" <vguntaka(at)candera(dot)com>
To: <jao(at)geophile(dot)com>, "Thomas F(dot)O'Connell" <tfo(at)sitening(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Any reason not to use inheritance?
Date: 2004-09-20 22:55:41
Message-ID: 5F90B589E007484AA3C305D4AE984C7501C9520D@mail2.confluencenetworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please replace Polyhedra with PostgreSQL in the last paragraph of my previous mail. Sorry for the inconvenience.

Sagar.

-----Original Message-----
From: Vidyasagara Guntaka
Sent: Monday, September 20, 2004 3:44 PM
To: jao(at)geophile(dot)com; Thomas F.O'Connell
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Any reason not to use inheritance?

I thought that this would be useful to this mailing list:

Our company uses Polyhedra in memory database for storing our object model. We have roughly around 250 C++ classes that need to be persisted. The object model is very complicated involving inheritance hierarchies, associations and aggregations (all kinds of relations that are defined using UML). Polyhedra does not confirm to SQL95 standards but, it has good support for inheritance.

Some time ago I was working on to replace Polyhedra in our product with PostgreSQL. Though PostgreSQL does not support automatically propagating constraints, uniqueness of indexes etc to derived tables, I could achieve same functionality by setting up alter table statements and triggers.

It will be definitely good if Polyhedra directly supports inheriting constraints. It will make mapping the C++/Java objects models into PostgreSQL schema much easier.

Regards,
Sagar.

-----Original Message-----
From: jao(at)geophile(dot)com [mailto:jao(at)geophile(dot)com]
Sent: Monday, September 20, 2004 3:16 PM
To: Thomas F.O'Connell
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Any reason not to use inheritance?

Quoting "Thomas F.O'Connell" <tfo(at)sitening(dot)com>:

> Just beware that inheritance is not a complete methodology in postgres.
> The implementation has limitations. For instance, indexes in parent
> tables will not be inherited by children.
>
> I've yet to encounter a scenario that actually required inheritance.
> I've used it a few times, but when I have, the end result always
> required a bit more work because of the incomplete aspects of the
> postgres implementation (namely constraints and indexes).

Could you expand on this?

All indexes and constraints would be declared on the child tables.
Nearly all table reference would be to the child tables. (So why use
inheritance at all? If for no other reason, all the common
columns would be declared in one place.)

Jack Orenstein

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Browse pgsql-general by date

  From Date Subject
Next Message David Helgason 2004-09-20 23:00:41 Re: Any reason not to use inheritance?
Previous Message Vidyasagara Guntaka 2004-09-20 22:44:22 Re: Any reason not to use inheritance?