Re: Trying to Understand Table Inheritance - Mailing list pgsql-general

From Richard Broersma Jr
Subject Re: Trying to Understand Table Inheritance
Date
Msg-id 653466.86528.qm@web31801.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Trying to Understand Table Inheritance  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-general
--- Jeff > You can create a table called order_item with columns that exist for all
> items (the shared columns). Create a table called merchandise with
> columns that exist only for merchandise and not other items (without any
> of the shared columns).
>
> When you insert new merchandise, put the common values into the
> order_item table, and the merchandise-specific attributes into the
> merchandise table with a foreign key to the order_item record. When you
> want all the items, select from order_item. When you want only the
> merchandise, join the order_item and merchandise tables, and of course
> the join will eliminate all non-merchandise records. And you can do the
> same for memberships and subscriptions.

Then if you wanted, you could add one additional layer to for convienence.  you can create
multiple updateable views, one view for each of your extenction tables such as mechandise in this
example  that are joined back to your primary table.

This way you can handle each relation seperately.

Regards,

Richard Broersma.

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: VACUUM and transactions in different databases
Next
From: Cornelia Boenigk
Date:
Subject: Re: VACUUM and transactions in different databases