Re: DB design and foreign keys

Поиск
Список
Период
Сортировка
От Gianluca Riccardi
Тема Re: DB design and foreign keys
Дата
Msg-id 439FF2E9.5040405@moonwatcher.it
обсуждение исходный текст
Ответ на Re: DB design and foreign keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
[cut]

> order_code is not by itself unique --- SERIAL doesn't guarantee that.
>  
>
that was my misunderstanding, i thought (misunderstood) that 'serial' 
implied 'unique'

> I'm not sure why you are declaring the primary key of orders as being
> the combination of *two* serial columns,

i thought it was good design choice and even needed for foreign keys 
referencing on them

> but if that's what you really
> need
>
i'm not shure about that

> and you also want to be able to reference a row by just one of
> them, you'll need to apply a separate unique constraint to just the
> order_code column.
>  
>
sorry, i'm afraid i didn't understand: are you suggesting to apply the 
constraint in case the primary key is kept on the combination of the two 
serial columns? or to remove the primary key of the two serial columns?

>             regards, tom lane
>  
>
thanks a lot for your kind response, best regards,
Gianluca Riccardi


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

Предыдущее
От: "Magnus Hagander"
Дата:
Сообщение: Re: Multi-row update w. plpgsql function
Следующее
От: Gianluca Riccardi
Дата:
Сообщение: Re: DB design and foreign keys