deferred constraints don't work correctly

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: deferred constraints don't work correctly
Date: 2001-03-22 11:43:06
Message-ID: 200103221143.f2MBh6k38019@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Robert Bihlmeyer (robbe(at)orcus(dot)priv(dot)at) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
deferred constraints don't work correctly

Long Description
Using the example code, I get "ERROR: <unnamed> referential integrity violation - key in foo still referenced from bar". It should be ok to delete and reinsert referenced keys with deferred contraints -- that's one of their points, ain't it?

Sample Code
create table foo(
key int primary key,
val varchar
);

create table bar(
foo int references foo(key) deferrable initially deferred,
attr varchar
);

insert into foo(key, val) values (1, 'one');
insert into foo(key, val) values (2, 'two');
insert into bar(foo, attr) values (1, 'low');
insert into bar(foo, attr) values (1, 'small');
insert into bar(foo, attr) values (2, 'higher');
insert into bar(foo, attr) values (2, 'bigger');

begin work;
delete from foo where key = 1;
insert into foo(key, val) values (1, 'uno');
commit;

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter T Mount 2001-03-22 14:46:43 Re: JDBC and getTimestamp() exception
Previous Message Kiran Patel 2001-03-22 11:09:42 need solution for cachelookupfailed error