Re: [GENERAL] Circular references

2013-06-21 Thread Alban Hertroys
On 21 June 2013 05:08, Tom Lane t...@sss.pgh.pa.us wrote: Melvin Call melvincall...@gmail.com writes: I was given a dump of an existing remote schema and database, and the restore on my local system failed. Looking into it, I found a circular parent-child/child-parent relationship, and I

Re: [GENERAL] Circular references

2013-06-21 Thread Ladislav Lenart
Hello. I think this CAN happen in practice when the constraints are DEFERRED, because as such are checked at COMMIT time. HTH, Ladislav Lenart On 21.6.2013 05:08, Tom Lane wrote: Melvin Call melvincall...@gmail.com writes: I was given a dump of an existing remote schema and database, and

Re: [GENERAL] Circular references

2013-06-21 Thread Melvin Call
Hi Tom, First an apology of sorts. The restore doesn't fail, but the COPY statements generate errors about the referenced table not containing the key values (as you seem to have figured out that I meant). I have no idea what version of PostgreSQL the remote system is running, I just have the

Re: [GENERAL] Circular references

2013-06-21 Thread Melvin Call
Hi Ladislav and Alban, Thanks for the suggestions regarding the DEFERRED constraint. While certainly a viable option, I would expect the dump to maintain those constraints. The lack of them indicates to me that somehow an initial insert was created and then the structure was modified to support

Re: [GENERAL] Circular references

2013-06-21 Thread David Johnston
Melvin Call wrote To summarize, the organization entity has an attribute of creator, which is a foreign key to the user table, but the user has to belong to an organization, which is a foreign key to the organization table. Since neither are nullable, there is no way to create even an initial

[GENERAL] Circular references

2013-06-20 Thread Melvin Call
I was given a dump of an existing remote schema and database, and the restore on my local system failed. Looking into it, I found a circular parent-child/child-parent relationship, and I don't believe this existing structure is viable. To summarize, the organization entity has an attribute of

Re: [GENERAL] Circular references

2013-06-20 Thread Tom Lane
Melvin Call melvincall...@gmail.com writes: I was given a dump of an existing remote schema and database, and the restore on my local system failed. Looking into it, I found a circular parent-child/child-parent relationship, and I don't believe this existing structure is viable. To summarize,