Foreign Keys - Mailing list pgsql-general

From Thomas LeBlanc
Subject Foreign Keys
Date
Msg-id Law9-F94iZWw8gRzpPW00003b12@hotmail.com
Whole thread Raw
Responses Re: Foreign Keys  (Ben <bench@silentmedia.com>)
Re: Foreign Keys  (Bruno Wolff III <bruno@wolff.to>)
Re: Foreign Keys  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
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?

Below are 2 table's scripts:

create table table1 (
    t1_id         VARCHAR(32) not null,
    t1_desc         VARCHAR(32)      null,
constraint table1_pkey primary key (t1_id) )  ;


create table table2 (
    t2_id        VARCHAR(32) not null,
    t1_id         VARCHAR(32) null,
                t2_desc                     VARCHAR(32) null,
  constraint table2_pkey primary key (t2_id) )  ;

create index table2_t1_id
    on table2 ( t1_id )  ;

alter table table2
    add constraint table1_table2_t1_id_FK1
    foreign key ( t1_id )
    references table1 ( t1_id )
    ON DELETE RESTRICT ON UPDATE CASCADE ;

_________________________________________________________________
Is there a gadget-lover on your gift list?  MSN Shopping has lined up some
good bets!  http://shopping.msn.com


pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: linking postgre to AD
Next
From: Carmen Gloria Sepulveda Dedes
Date:
Subject: Re: Execute vacuum