cascade deleting

From: Duan Ligong <duanlg(at)nec-as(dot)nec(dot)com(dot)cn>
To: pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: cascade deleting
Date: 2009-05-22 01:48:19
Message-ID: 20090522090031.4797.DUANLG@nec-as.nec.com.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hi.

I am wondering whether the following problem can
be avoided by using Cascade Deleting while the DB
is in Read Committed Isolation Level:

In the following scenario, The "DEL item1 from tb_pk"
command fails because of involating foreign key
constraints.

(The tb_fk1, tb_fk2, and tb_fk3 tables reference the
tb_pk table)
Transaction A Transaction B
begin() |
| |
DEL item1 from tb_fk1 begin()
| |
DEL item1 from tb_fk2 INS item1 into tb_fk1
| |
DEL item1 from tb_fk3 commit()
|
DEL item1 from tb_pk
|
|( failed because of involating foreign key constraint.)
|
commit()

My real question is:
Will Executing "CASCADE DEL item1 from tb_pk" fail
if another transaction insert item1 into tb_fk1
during executing "CASCADE DEL item1 from tb_pk"?

Thanks
Duan

---------------------------------------------------
Duan Ligong
E-MAIL : duanlg(at)nec-as(dot)nec(dot)com(dot)cn
Tel : 010-82334433-354
: 8-0086-22-354

Browse pgsql-admin by date

  From Date Subject
Next Message Cliff Pratt 2009-05-22 03:51:42 Postgres user with a shell of /bin/false
Previous Message Tom Lane 2009-05-21 14:30:35 Re: [GENERAL] compilation test fails

Browse pgsql-general by date

  From Date Subject
Next Message Postgres User 2009-05-22 02:27:30 How to restore a SQL-ASCII encoded database to a new UTF-8 db?
Previous Message Adrian Klaver 2009-05-22 01:36:24 Re: Re: Re: [GENERAL] Can not decompress a compressed string under plpy!