Re: Is cycle references?
От | Tod McQuillin |
---|---|
Тема | Re: Is cycle references? |
Дата | |
Msg-id | Pine.GSO.4.21.0011011931270.6485-100000@sysadmin обсуждение исходный текст |
Ответ на | Is cycle references? (<limin@www.pumpkinnet.com>) |
Ответы |
Re: Is cycle references?
|
Список | pgsql-general |
On Wed, 1 Nov 2000 limin@www.pumpkinnet.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
В списке pgsql-general по дате отправления: