Triggers and RI on ASE for Linux

Triggers and RI on ASE for Linux

Post by Mike Conn » Thu, 30 Sep 1999 04:00:00



This is for SQL Server/11.0.3.3/P/Linux Intel/Linux 2.0.36:

I have a table, master, and a dependant table, slave. There is a foreign
key constraing on master.master_id from slave.slave_id. I also have
a delete trigger which does a cascade delete on slave if a like row
in master is deleted.  

The problem is, this doesn't work.  The RI is being tested before the
trigger fires.  I had hoped that that RI would be tested at the end of the
transaction, after the trigger has had the opportunity do its work.

Is there any way to do this?

-Mike

--
Michael J Conner
Enforcer Technology, Inc

 
 
 

Triggers and RI on ASE for Linux

Post by Lyle H. Gra » Thu, 30 Sep 1999 04:00:00



Quote:> This is for SQL Server/11.0.3.3/P/Linux Intel/Linux 2.0.36:

> I have a table, master, and a dependant table, slave. There is a foreign
> key constraing on master.master_id from slave.slave_id. I also have
> a delete trigger which does a cascade delete on slave if a like row
> in master is deleted.  

> The problem is, this doesn't work.  The RI is being tested before the
> trigger fires.  I had hoped that that RI would be tested at the end of the
> transaction, after the trigger has had the opportunity do its work.

> Is there any way to do this?

Not currently, no.  You will have to code the RI into the triggers as well
and drop the constraint.

Lyle H. Gray

 
 
 

Triggers and RI on ASE for Linux

Post by Bret Halfor » Thu, 30 Sep 1999 04:00:00




> > This is for SQL Server/11.0.3.3/P/Linux Intel/Linux 2.0.36:

> > I have a table, master, and a dependant table, slave. There is a foreign
> > key constraing on master.master_id from slave.slave_id. I also have
> > a delete trigger which does a cascade delete on slave if a like row
> > in master is deleted.

> > The problem is, this doesn't work.  The RI is being tested before the
> > trigger fires.  I had hoped that that RI would be tested at the end of the
> > transaction, after the trigger has had the opportunity do its work.

> > Is there any way to do this?

> Not currently, no.  You will have to code the RI into the triggers as well
> and drop the constraint.

Or perform deletes through a stored procedure that deletes from the child first,

then the master.

-bret