| От | Jorge Godoy |
|---|---|
| Тема | Re: foreign key problem |
| Дата | |
| Msg-id | 200809160728.37556.jgodoy@gmail.com обсуждение исходный текст |
| Ответ на | foreign key problem (pcreso@pcreso.com) |
| Список | pgsql-general |
Em Monday 15 September 2008 19:05:25 pcreso@pcreso.com escreveu: > Hi, > > I need a foreign key (or equivalent) where the referenced table cannot have > a unique constraint. > > For fisheries surveys we have a table of catch records. For a given event, > several species are caught, and are weighed by one or more methods. Thus a > given event may have more than one record for the same spaecies, as parts > of the catch may be weighed differently. > > When we sample a species for measuring, the event is recorded, but as the > sample may include individuals from throughout the catch, it does not > necessarily relate to the catch-with-method table. Looks like you need a composite primary key here, i.e. a primary key for the "category" of the record will have more than one column (such as species and method of catch). With that you'll be able to uniquely identify the "event" and then associate it with the record. -- Jorge Godoy <jgodoy@gmail.com>
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера