Skip site navigation (1) Skip section navigation (2)

Re: BUG #2771: NULL values in FOREIGN KEY fields

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: vincent <vincent(at)iim(dot)nctu(dot)edu(dot)tw>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2771: NULL values in FOREIGN KEY fields
Date: 2006-11-21 02:03:15
Message-ID: c2d9e70e0611201803g7d630698ibf1572ec586aa85@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On 11/20/06, vincent <vincent(at)iim(dot)nctu(dot)edu(dot)tw> wrote:
> When insert a null value in foreign key fields, an error occurs.
>
> CREATE TABLE TGroup (
>   C_Group_ID CHAR(8) NOT NULL,
>   C_Group_Name VARCHAR(50),
>   C_Group_Parent CHAR(8) NOT NULL,
>   CONSTRAINT TGroup_C_Group_Parent_fkey FOREIGN KEY (C_Group_Parent)

That's because your C_Group_Parent column has a Not Null constraint
and you can't insert null values in a Not Null columns

-- 
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
                                       Richard Cook

In response to

pgsql-bugs by date

Next:From: Euler Taveira de OliveiraDate: 2006-11-21 02:28:46
Subject: Re: BUG #2771: NULL values in FOREIGN KEY fields
Previous:From: Tom LaneDate: 2006-11-21 01:58:10
Subject: Re: BUG #2768: dates before year 1600 in timestamptz column give strange results

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group