Re: references table(multiple columns go here)

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: references table(multiple columns go here)
Дата
Msg-id 3E019829.204@klaster.net
обсуждение исходный текст
Ответ на references table(multiple columns go here)  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Ответы Re: references table(multiple columns go here)  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список 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




В списке pgsql-sql по дате отправления:

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: Re: references table(multiple columns go here)
Следующее
От: Gary Stainburn
Дата:
Сообщение: Re: references table(multiple columns go here)