Re: Foreign Keys

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Thomas LeBlanc <thomasatiem(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign Keys
Date: 2003-11-21 21:04:45
Message-ID: 20031121210445.GA8080@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 21, 2003 at 14:35:54 -0600,
Thomas LeBlanc <thomasatiem(at)hotmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera Munoz 2003-11-21 21:08:37 Re: Execute vacuum
Previous Message Jan Wieck 2003-11-21 21:00:18 Re: Where is Postgesql ? - MYSQL SURPRISES WITH MAXDB /