Re: Column References - Mailing list pgsql-admin

From Bruno Wolff III
Subject Re: Column References
Date
Msg-id 20031101172058.GA20268@wolff.to
Whole thread Raw
In response to Column References  ("Epps, Aaron M." <Epps.Aaron@mayo.edu>)
List pgsql-admin
On Fri, Oct 31, 2003 at 13:44:40 -0600,
  "Epps, Aaron M." <Epps.Aaron@mayo.edu> wrote:
>     I've got a question about references, is it possible to specify criteria for the Reference.  For example, Table 1
hasField1 That References Field1 in Table2, However I only want Field 1 in Table 1 to reference the Records in Table2
thathave the Valid Field set to TRUE.  In other words, I don't want the user to be able to enter invalid records from
table2 into field 1 in table 1.  Is there a different way of accomplishing the same thing? 

The way I have done this is to use redundant data in table1. For example in
your case you might include a Valid field in table 1 with a constraint
forcing it to always be true. Then you can use a two column foreign key
reference from table 1 to table 2 that will enforce your constraint.
(You will also need to make a unique index on the two column combination
in table2.)

pgsql-admin by date:

Previous
From: Dmitry Morozovsky
Date:
Subject: Re: Shared memory corrupted?
Next
From: "Ganesan Kanavathy"
Date:
Subject: pgAdmin