Search Postgresql Archives

Re: Circular references

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 record. My
> guess is one or both of the tables was first populated, and then the FK
> constraint(s) created.

You only need solve the chicken-egg problem once with pre-loaded data then
all new organizations can be added normally.  What this requires is that
someone external to the organization be the creation user.  So
"admin@admin_company" is the "created by" user for organization
"@client_company" and that user should also then create an
"admin@client_company" who would then be - generally - the creator for other
organizational objects.  You just need to get "@admin_company" and
"admin@admin_company" into the database (via deferred constraint resolution
or before constraints are added) and you are good to go.

David J.






--
View this message in context: http://postgresql.1045698.n5.nabble.com/Circular-references-tp5760228p5760340.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux