referential constraint bug

Поиск
Список
Период
Сортировка
От Eric Lu
Тема referential constraint bug
Дата
Msg-id 002b01c1c572$05ebd610$0c28a8c0@ecompliance.net
обсуждение исходный текст
Ответы Re: referential constraint bug  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-bugs
To whom it may concern:

 I found a constraint bug on PostgreSQL lastest version (7.2).

Here is how I got the bug.
------------------------------------------------------------------------------------------------
testdb=>
testdb=> create table mytest(
testdb-> id int primary key,
testdb-> masterid int constraint fk_mytest_constr1 REFERENCES mytest(id) ON DELETE CASCADE ON UPDATE NO ACTION
DEFERRABLEINITIALLY DEFERRED 
testdb-> );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'mytest_pkey' for table 'mytest'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE
testdb=> begin;
BEGIN
testdb=> insert into mytest(id,masterid) values(1,null);
INSERT 447153 1
testdb=> insert into mytest(id,masterid) values(2,5);
INSERT 447154 1
testdb=> insert into mytest(id,masterid) values(3,2);
INSERT 447155 1
testdb=> update mytest set masterid=1 where id=2;
UPDATE 1
testdb=> end;
ERROR:  fk_mytest_constr1 referential integrity violation - key referenced from mytest not found in mytest
testdb=>
------------------------------------------------------------------------------------------------

Eric

PS. 1.There won't be such an error if I do another insert statement which doesn't violate the reference constraint
    before ending the transaction.(eg.insert into mytest(id,masterid) values(4,3);)
  2.It happens while I was using ver7.1.3 and I do an upgrade and run the regression test(everything is fine).
  3.It's on a pentium 75(run as 120MHZ) with 40MB RAM, Redhat 6.1

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Nicolas Paymal"
Дата:
Сообщение: JDBC Trouble when exception appears .
Следующее
От: Laurent FAILLIE
Дата:
Сообщение: Re: Bug #608: cache lookup failed