From: | Tomasz Myrta <jasiek(at)klaster(dot)net> |
---|---|
To: | Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: references table(multiple columns go here) |
Date: | 2002-12-19 09:58:01 |
Message-ID: | 3E019829.204@klaster.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Gary Stainburn wrote:
> That did the trick. However, I now have another problem with the
> constraint
> complaining about there not being an index to refer to. However,
> there is.
> Output below:
>
> create table ranks (
> rid int4 default nextval('ranks_rid_seq'::text) unique not null,
> rdid character references depts(did), -- department
> rrank int4 not null, -- departmental rank
> rdesc character varying(40) -- Rank Description
,CONSTRAINT ranks_pkey PRIMARY KEY (rid,rrank)
or
,CONSTRAINT ranks_unq UNIQUE (rid,rrank)
>
> );
Create primary key on two fields in table ranks, or at least create
unique constraint on them.
If rid is unique, why do you use two fields as foreign key? "rid" is
enough. You can get rid of "rrank" in table jobtypes.
And one more question - why you don't use the same names in all tables?
"did" instead of "did" "rdid" "jdid" ? It's much easier to create joins
when using the same names.
Tomasz Myrta
From | Date | Subject | |
---|---|---|---|
Next Message | Gary Stainburn | 2002-12-19 10:30:11 | Re: references table(multiple columns go here) |
Previous Message | Gary Stainburn | 2002-12-19 09:28:19 | Re: references table(multiple columns go here) |