Inheritence woes

From: Hadley Willan <hadley(dot)willan(at)deeperdesign(dot)co(dot)nz>
To: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Inheritence woes
Date: 2003-04-24 01:23:04
Message-ID: 1051147384.1686.22.camel@atlas.sol.deeper.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello All,
We've been playing with Inheritence and have perhaps not used it
correctly.

Our original intention was to have a generic table called unit, then we
dealing with different types of units, like boats, or cars, or marine
outboards for example, they can then inherit off unit and get a common
set of attributes.

As we've progressed things like the purchase costs for these items needs
to be recorded and we've added in a table like, unit_purchase_cost.
However, because the unit type car inherits unit, unit_purchase_cost
can't use a foreign key that references unit.id because the values are
in car.

Doing a SELECT * FROM ONLY unit; shows no values as they're all in car.

About the only away around this right now we can see is to write our own
foreign key triggers, allowing the insert of the value without the
referential integrity to the parent class?

Any other thoughts on this?

Thanks.
--
Hadley Willan > Systems Development > Deeper Design Limited. +64(7)377-3328
hadley(dot)willan(at)deeperdesign(dot)co(dot)nz > www.deeperdesign.com > +64(21)-28-41-463
Level 1, 4 Tamamutu St, PO Box 90, TAUPO 2730, New Zealand.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message milimeter@163.com 2003-04-24 01:38:58 jdbc problem
Previous Message Dennis Gearon 2003-04-24 00:04:46 Re: ERROR: array_in: Need to specify dimension