-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The easiest way out is probably to create a relationship entity
called 'default' between customer and shop for the default
relationship. This way you only have to have one direct
relationship, because the other is expressed through the 'default'
table.
Just a thought...
MikeA
>> -----Original Message-----
>> From: William Courtier [mailto:[EMAIL PROTECTED]]
>> Sent: 07 August 2001 11:10
>> To: [EMAIL PROTECTED]
>> Subject: [SQL] Re: Are circular REFERENCES possible ?
>>
>>
>> I denis,
>>
>> I don't know if you can use a circular REFERENCES, but why
>> you try made a
>> references before the table is created (customers). You
>> should create the
>> references after and use the foreign key if circular
>> references does not
>> work.
>>
>> William
>> "Denis Bucher" <[EMAIL PROTECTED]> a écrit dans le message
>> news: [EMAIL PROTECTED]
>> >
>> > Hello !
>> >
>> > I have a case where I wanted to do circular REFERENCES, is this
>> > impossible ?
>> >
>> > Just an example where it would be useful :
>> >
>> > We deliver to the *shops* of our *customers*.
>> > We have therefore two tables :
>> > - customers (enterprise, financial information, and so on...)
>> > - shop (with a name, street, phone number, name of manager)
>> >
>> > Now, each shop REFERENCES a customer so that we know
>> > to which customer belongs a shop.
>> >
>> > AND, each customer has a DEFAULT shop for deliveries, i.e. most
>> > customers only have one shop, or a main shop and many small
>> > ones. Therefore a customer should REFERENCES the 'main' or
>> 'default' shop.
>> >
>> > Which leads to :
>> >
>> > CREATE TABLE shops ( id_shop SERIAL PRIMARY KEY, id_cust integer
>> REFERENCES
>> > customers, .......)
>> > CREATE TABLE customers ( id_cust SERIAL PRIMARY KEY,
>> > id_defaultshop
>> integer
>> > REFERENCES shops, .......)
>> >
>> > But this doesn't work ! Postgres complains like "ERROR:
>> > Relation 'customers' does not exist"
>> > when creating 'shops'.
>> >
>> > Someone told me I should create a third table, ok, but in
>> this case I
>> loose
>> > the total
>> > control about my logic... Do you have a suggestion ?
>> >
>> > Thanks a lot in advance !
>> >
>> > Denis
>> >
>> >
>> > ---------------------------(end of
>> broadcast)---------------------------
>> > TIP 1: subscribe and unsubscribe commands go to
>> [EMAIL PROTECTED]
>>
>>
>>
>> ---------------------------(end of
>> broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister
>> command
>> (send "unregister YourEmailAddressHere" to
>> [EMAIL PROTECTED])
>>
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBO3kkqnympNV/C086EQKcWgCfd1Z2Hbi/g7Rj633Myj67HxkjgvkAn1n+
hXvHqca0bqE73XY4tmjDq/7v
=2nf2
-----END PGP SIGNATURE-----
_________________________________________________________________________
This e-mail and any attachments are confidential and may also be privileged and/or copyright
material of Intec Telecom Systems PLC (or its affiliated companies). If you are not an
intended or authorised recipient of this e-mail or have received it in error, please delete
it immediately and notify the sender by e-mail. In such a case, reading, reproducing,
printing or further dissemination of this e-mail is strictly prohibited and may be unlawful.
Intec Telecom Systems PLC. does not represent or warrant that an attachment hereto is free
from computer viruses or other defects. The opinions expressed in this e-mail and any
attachments may be those of the author and are not necessarily those of Intec Telecom
Systems PLC.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
__________________________________________________________________________