From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Possible Addition of a CREATE TABLE Warning |
Date: | 2001-03-04 02:50:44 |
Message-ID: | 200103040250.f242oi364857@hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Austin C. Brooks (acbrooks(at)southern(dot)edu) reports a bug with a severity of 4
The lower the number the more severe it is.
Short Description
Possible Addition of a CREATE TABLE Warning
Long Description
The enclosed CREATE TABLE statement attempts to create a not-nullable field that is a foreign key into another table. One of the foreign key constraints, however, is that the field be set null when the referenced tuple is deleted. Unfortunately, this action is not possible because the field is not-nullable, and thus the foreign key constraint will fail out every time. This is expected behavior, but it might be helpful to schema designers (or newbies, as I was) if a warning message indicated this possibility (ie, that the DBA would have to manually delete or alter every referencing tuple in the table before he can delete the referenced tuple). PostgreSQL 7.0.3 currently processes the table without complaint, which is fine for people that understand what is happening.
Sample Code
CREATE TABLE myTable2 (
...
myField int not null,
...
foreign key (myField) references (myTable1) on delete set null,
-- 'on delete set null' will fail every time
...
);
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Marcin Wolinski | 2001-03-04 16:11:29 | 7.0.x not using indices |
Previous Message | Tom Lane | 2001-03-03 06:32:09 | Re: 7.1Beta 4&5 - clean build problem with '--with-perl' |