Cascade Deletes not working!!!
Posted in 1997
Is it possible that your child table ( attributes ) is also a parent
table to some third table, and you don't have cascade delete specified
on that table? Or perhaps you have a 2nd parent-child relationship
between the parent table (products) and another table, again without
cascade deletes.
Mike Ballentine
--------------------------( Forwarded letter 1 follows )---------------------
Date: Sunday, 6 April 1997 11:48pm
From: walker@imap1.asu.edu
Subject: Cascade Deletes not working!!!
Date:Sun, 6 Apr 1997 22:32:35 -0500
Reply-To: walker@imap1.asu.edu
Organization: Arizona State University
Sender: informix-list-owner@rmy.emory.edu
To: informix-list@rmy.emory.edu
X-Informix-List-Id: <news.36251>
Hello everybody...
I have the following two tables:
create table Products
(
productId char(20) primary key,
active int,
validPriceType char(20),
description char(80),
stockQty int
);
create table Attributes
(
productId char(20),
attribType char(20),
attribValue char(40),
attribPrice money,
attribPriceType char(20),
formType char(20),
sequence int,
primary key (productId, attribType, attribValue),
foreign key (productId) references Products (productIBd)
on delete cascade
);
....and yet when I run a simple delete query like:
delete from Products where productId = 'abc123' I get the followingmessage from dbaccess:
692: Key value for constraint (walker.u107_11) is still being referenced.
That's supposed to delete the record in Products and then delete the
corresponding row from Attributes, right? I don't understand!
Any help would be much appreciated :-)
Cheers,
-Robin