Re: Is cycle references?

From: Tod McQuillin <devin(at)spamcop(dot)net>
To: limin(at)www(dot)pumpkinnet(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is cycle references?
Date: 2000-11-02 01:34:11
Message-ID: Pine.GSO.4.21.0011011931270.6485-100000@sysadmin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 1 Nov 2000 limin(at)www(dot)pumpkinnet(dot)com wrote:

> The db schema we have need to do a cycle references. I.e.,
> an attribute in table_1 references the key in table_2 and
> an attribute in table_2 references the key in table_1. However,
> PostgreSQL does not allow us to make reference to an "non-existing" table!
>
> Is there any work-around on this issue?

I had the same problem. You can play around with creating the tables
without the RI checks and adding the constraints later, but I found this
clumsy.

The solution I used was to have a third table with attributes referencing
keys from table_1 and table_2. This avoids the problem of inserting
references to keys which don't exist yet, and you can use joins from
table_[12] to table_3 to do the same queries you would have done with the
cross-referential tables.
--
Tod McQuillin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2000-11-02 03:26:50 Re: Re: [GENERAL] 7.0 vs. 7.1 (was: latest version?)
Previous Message Justin Foster 2000-11-02 00:10:21 Memory Leak