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



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to