From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | ON DELETE SET NULL clauses do error when more than two columns are referenced to one table |
Date: | 2007-08-11 18:00:48 |
Message-ID: | 162867790708111100x3775c51bi53dbecabb97d14b7@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-patches |
Hello
One question on www.abclinuxu.cz signalise bug in PostgreSQL RI
implementation. Detected on 8.0.x and verified on 8.3.
Regards
Pavel Stehule
CREATE TABLE users (
id integer NOT NULL,
name VARCHAR NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO users VALUES (1, 'Jozko');
INSERT INTO users VALUES (2, 'Ferko');
INSERT INTO users VALUES (3, 'Samko');
CREATE TABLE tasks (
id integer NOT NULL,
owner INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL,
worker INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL,
checked_by INT REFERENCES users (id) ON UPDATE CASCADE ON DELETE SET NULL,
PRIMARY KEY (id)
);
INSERT INTO tasks VALUES (1,1,NULL,NULL);
INSERT INTO tasks VALUES (2,2,2,NULL);
INSERT INTO tasks VALUES (3,3,3,3);
DELETE FROM users WHERE id = 1; -- works simple
DELETE FROM users WHERE id = 2; -- works ok
DELETE FROM users WHERE id = 3; -- doesn't work, why?
ERROR: insert or update on table "tasks" violates foreign key
constraint "tasks_checked_by_fkey"
DETAIL: Key (checked_by)=(3) is not present in table "users".
CONTEXT: SQL statement "UPDATE ONLY "public"."tasks" SET "worker" =
NULL WHERE $1 OPERATOR(pg_catalog.=) "worker""
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2007-08-13 12:32:42 | Re: ON DELETE SET NULL clauses do error when more than two columns are referenced to one table |
Previous Message | Magnus Hagander | 2007-08-10 21:38:02 | Re: BUG #3512: buggy install + no manual support |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2007-08-12 04:06:33 | Re: final CSVlog patch |
Previous Message | Tom Lane | 2007-08-11 05:15:12 | Re: strpos() && KMP |