Re: Foreign Keys - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Foreign Keys
Date
Msg-id 20031121210445.GA8080@wolff.to
Whole thread Raw
In response to Foreign Keys  ("Thomas LeBlanc" <thomasatiem@hotmail.com>)
List pgsql-general
On Fri, Nov 21, 2003 at 14:35:54 -0600,
  Thomas LeBlanc <thomasatiem@hotmail.com> wrote:
> I am able to enter a null in a foreign key field in one table(table2)
> without the foreign key relationship (table1.t1_id) validating the value.
> Why is this?

That is how foreign keys work. If you don't want null values for the
foreign key, use a not null constraint in addition to the foreign
key constraint.

You shouldn't be using null key values in the referenced table.

pgsql-general by date:

Previous
From: Dima Tkach
Date:
Subject: Re: Two rules on a view do not like each other :-(
Next
From: Alvaro Herrera Munoz
Date:
Subject: Re: Execute vacuum