Re: M:M table conditional delete for parents

From: Kenneth Downs <ken(at)secdat(dot)com>
To: MargaretGillon(at)chromalloy(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: M:M table conditional delete for parents
Date: 2007-03-06 13:48:05
Message-ID: 45ED7115.3000506@secdat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

MargaretGillon(at)chromalloy(dot)com wrote:
>
> Postgresql 8.1.4 on Redhat 9
>
> I have a table which stores M:M relationships. I can't put foreign
> keys to the parents of this table because the relationships being
> stored go to several tables. This was done so that only two fields
> have to be searched in order for all relationships to be found for an
> item. For an oem number there might be 50 to 100 relationships and 40
> different tables having to do with materials, locations, revisions,
> specifications, customer, etc. that might be referenced.

Have you considered creating real cross-reference tables (aka M:M)
between all pairs of tables, and then having a view that UNIONs them
together?

This way you don't have to re-invent the foreign key to get it all working.

--
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com / www.andromeda-project.org
Office: 631-689-7200 Cell: 631-379-0010

::Think you may have a problem with programming? Ask yourself this
::question: do you worry about how to throw away a garbage can?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-03-06 13:58:11 Re: Does it has a way to compact the database size?
Previous Message Kenneth Downs 2007-03-06 13:44:11 Re: RFC tool to support development / operations work with slony replicated databases