Got a client with an interesting problem I haven't seen before.
They have a table that's self-joined to form a hierarchy of parents and children. When attempting to change the primary key of a parent, they get a "Trigger Failed" error and AERROR returns "Illegal recursion in rule evaluation."
Here's a way to repro:
CREATE DATABASE testri CREATE TABLE testtable (iKeyPK I, iParentFK i) INSERT INTO testtable VALUES (1,1) INSERT INTO testtable VALUES (2,1) INSERT INTO testtable VALUES (3,1) INSERT INTO testtable VALUES (4,1) INSERT INTO testtable VALUES (5,2) INSERT INTO testtable VALUES (6,2)
* Modify the database and define indexes for both keys. iKeyPK should be a primary index. * Define a self-join relationship in the database by dragging the primary index to the iParentFK index. * Click on the relatiionship and define referential integrity as Cascade-Restrict-Restrict
set multilocks on browse
* Try to change the first record (1,1) to (6,1)
ideally, the client is looking for a solution we can keep in the triggers, as data is updated both through an application and from browses. Suggestions welcomed.
Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com
©2004 Ted Roche |