From: | Jorge Godoy <jgodoy(at)gmail(dot)com> |
---|---|
To: | pcreso(at)pcreso(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: foreign key problem |
Date: | 2008-09-16 10:28:33 |
Message-ID: | 200809160728.37556.jgodoy@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Em Monday 15 September 2008 19:05:25 pcreso(at)pcreso(dot)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(at)gmail(dot)com>
From | Date | Subject | |
---|---|---|---|
Next Message | Enrico Sabbadin | 2008-09-16 11:15:41 | client_encoding / postgresql strange behaviour |
Previous Message | Joao Ferreira gmail | 2008-09-16 10:11:12 | Re: about partitioning |