cascade deleting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx
Tel        : 010-82334433-354
            : 8-0086-22-354


-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux