OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Again: Problem with "ON DELETE SET NULL"

From: Ralf Schneider (mltapfere-schneiderleins.de)
Date: Tue Jan 10 2006 - 15:14:40 CST


Hi,

I did not get a real answer to my question two weeks ago, so I try it again:

I try to create a table with two foreign key definitions like the following
statement on a MaxDB 7.5.0.19:

create table USERS
(
        ID integer not null,
        USERNAME varchar(100) not null,
        CREATED_BY integer,
        MODIFIED_BY integer,
        primary key (ID),
        FOREIGN KEY FK_USER_REFE_USER1 (CREATED_BY) REFERENCES USERS (ID) ON
DELETE
SET NULL,
        FOREIGN KEY FK_USER_REFE_USER2 (MODIFIED_BY) REFERENCES USERS (ID) ON
DELETE
SET NULL
)

This statement fails with an error:
SQL error -7040 = Referential constraint not allowed (error position: 1)

When I remove one of the foreign key definitions (doesn't matter which one)
the statment works fine. When I replace the "ON DELETE SET NULL" by "ON
DELETE CASCADE" also executes without error.

Why can't I define these two foreign keys? I did not find any restrictions in
the docs describing this behavior.

Best regards,
Ralf.

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb