From: | "vincent" <vincent(at)iim(dot)nctu(dot)edu(dot)tw> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #2771: NULL values in FOREIGN KEY fields |
Date: | 2006-11-20 09:42:58 |
Message-ID: | 200611200942.kAK9gwaK029065@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 2771
Logged by: vincent
Email address: vincent(at)iim(dot)nctu(dot)edu(dot)tw
PostgreSQL version: 8.x
Operating system: windows2k
Description: NULL values in FOREIGN KEY fields
Details:
When insert a null value in foreign key fields, an error occurs.
example table
===================
CREATE TABLE TGroup (
C_Group_ID CHAR(8) NOT NULL,
C_Group_Name VARCHAR(50),
C_Group_Parent CHAR(8) NOT NULL,
CONSTRAINT TGroup_pkey PRIMARY KEY(C_Group_ID),
CONSTRAINT TGroup_C_Group_Parent_fkey FOREIGN KEY (C_Group_Parent)
REFERENCES TGroup(C_Group_ID)
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE
) WITHOUT OIDS;
The definition of foreign key constraint:
A FOREIGN KEY constraint does not have to be linked only to a PRIMARY KEY
constraint in another table; it can also be defined to reference the columns
of a UNIQUE constraint in another table. A FOREIGN KEY constraint can
contain null values; however, if any column of a composite FOREIGN KEY
constraint contains null values, verification of all values that make up the
FOREIGN KEY constraint is skipped. To make sure that all values of a
composite FOREIGN KEY constraint are verified, specify NOT NULL on all the
participating columns.
From | Date | Subject | |
---|---|---|---|
Next Message | S.Balaji | 2006-11-20 12:07:25 | BUG #2772: Undefined Subroutine Pg::connectdb (" "); |
Previous Message | Brahma | 2006-11-19 12:59:05 | BUG #2770: tomcat connection pool |