Re: Foreign key question - Mailing list pgsql-general

From James M Moe
Subject Re: Foreign key question
Date
Msg-id 4007057C.9040909@sohnen-moe.com
Whole thread Raw
In response to Re: Foreign key question  (Martin Marques <martin@bugs.unl.edu.ar>)
List pgsql-general
Victor Spång Arthursson wrote:
 >
 > The first is, i have a language table with a primary key on the
fields lang and relid:
 >
 > relid | lang |    text
 > -------+------+-------------
 >  11111 | uk   | hello
 >  11111 | dk   | hej
 >  11111 | de   | guten tag
 >  11112 | uk   | world
 >  11112 | dk   | værld
 >
 > In another table, texts, I have the following:
 >
 > id | text
 > -------+------+
 >  4 | 11112   |
 >
   Given what you have shown, there is no way foreign keys can work here.
   Foreign keys are links between the key values of two tables in a sort
of master/slave relationship.

 > What I want to do is to create a foreign key between the two tables.

   What problem does the concept of a foreign key solve for you?


--
jimoe at sohnen-moe dot com

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: serverless postgresql
Next
From: Tom Lane
Date:
Subject: Re: Bytea/Large Objects/external files best practices