Re: FK issue - Mailing list pgsql-general

From Doug McNaught
Subject Re: FK issue
Date
Msg-id 873c534dt9.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to FK issue  (mike <mike@bristolreccc.co.uk>)
List pgsql-general
mike <mike@bristolreccc.co.uk> writes:

> I have set up a FK as follows
>
> ALTER TABLE lk_sub_con ADD FOREIGN KEY (type) REFERENCES
> lk_sort_of_contact(type_code);
>
> However when I do this
>
> INSERT INTO lk_sort_of_contact (type_code) VALUES ('1') (ie: a NULL into
> the FK) it works
>
> Is this a bug?

No.

NULLs are permitted in referencing columns unless that column is
declared NOT NULL.

-Doug

pgsql-general by date:

Previous
From: mike
Date:
Subject: FK issue
Next
From: Oliver Elphick
Date:
Subject: Re: encrypted passwords