Re: Foreign key question - Mailing list pgsql-general

From Martin Marques
Subject Re: Foreign key question
Date
Msg-id 1074191672.4006dd3810c12@bugs.unl.edu.ar
Whole thread Raw
In response to Re: Foreign key question  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Foreign key question
Re: Foreign key question
List pgsql-general
Mensaje citado por Tom Lane <tgl@sss.pgh.pa.us>:

> Terry Lee Tucker <terry@esc1.com> writes:
> > From the HTML docs:
> > "The referenced columns must be the columns of a unique or primary key
> > constraint in the referenced table."
>
> > I personally don't know of a work around. Maybe some of the others do.
>
> There is no workaround, because foreign keys don't make any sense if
> there isn't a uniquely identifiable referenced row.

A better way to understand it is:

Foreign keys are many to one assignments.

Try to think of it as a function (mathematicaly speeking): You can't have an element
from the domain end up on two different elementos of the co-domain.

In simbols:

If f(x) = y and f(x) = z => y = z

Those this bring insight?

P.D.: Aparently you  are having problems with your database model.

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
---------------------------------------------------------
Martín Marqués          |   Programador, DBA
Centro de Telemática    |     Administrador
               Universidad Nacional
                    del Litoral
---------------------------------------------------------

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: CASE SELECT syntax
Next
From: Terry Lee Tucker
Date:
Subject: Re: Foreign key question