Re: [SQL] REFERENCES constraint

2001-08-12 Thread Josh Berkus
Cedar, > I guess I wasn't clear. Let me try to explain again: > > CREATE TABLE obj_weights ( > object_id int4 REFERENCES ( apple_objects(id) OR > banana_objects(id) ) > weight float4, > ) > > "apple_objects" doesn't necessarily have anything to do with > "banana_objects". Ok, don'

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Stephan Szabo
On Wed, 8 Aug 2001, Cedar Cox wrote: > > Two questions (maybe they are silly..) > > 1. Can a column reference more than one table? (This assumes you use a > single sequence to generate the IDs for both "tbla" and "tblb". I guess > you would also have the problem of enforcing a unique index.

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Jan Wieck
Josh Berkus wrote: > Cedar, > > > 1. Can a column reference more than one table? (This assumes you use > > a > > single sequence to generate the IDs for both "tbla" and "tblb". I > > guess > > you would also have the problem of enforcing a unique index. Say > > what?! > > A unique index across

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Grigoriy G. Vovk
As for me it is looking as not good normalized structure. After normalization should not be any questions, I think... Aug 8, 19:02 +0300, Cedar Cox wrote: > > Two questions (maybe they are silly..) > > 1. Can a column reference more than one table? (This assumes you use a > single sequence to g

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Josh Berkus
Cedar, (sorry for the double posting, folks) > 2. Can a column reference another column in the same table? eg.. > > CREATE TABLE bloo ( > id int4, > p_id int4 REFERENCES bloo (id) > -- or > --p_id int4 REFERENCES (id) > ) You don't do this with REFERENCES ... you do it with a

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Josh Berkus
Cedar, > 1. Can a column reference more than one table? (This assumes you use > a > single sequence to generate the IDs for both "tbla" and "tblb". I > guess > you would also have the problem of enforcing a unique index. Say > what?! > A unique index across multiple tables.. absurd :) eg..