OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
How to define 2 FK into 1 table

From: Dusan Kolesar (d.kolesarcentrum.sk)
Date: Mon Jan 30 2006 - 08:09:37 CST


Hello

I want to define folowing DB structure:
CREATE TABLE "SYSUSER"
(
   "ID" Integer NOT NULL DEFAULT SERIAL,
   "TSTAMP" Timestamp NOT NULL DEFAULT TIMESTAMP,
   "NAME" Varchar(30) ASCII NOT NULL,
   "PASSWORD" Varchar(30) ASCII NOT NULL,
   PRIMARY KEY ("ID")
)
//
CREATE TABLE "ADDRESS"
(
   "ID" Integer NOT NULL DEFAULT SERIAL,
   "TSTAMP" Timestamp NOT NULL DEFAULT TIMESTAMP,
   "CREATE_USER_ID" Integer NOT NULL DEFAULT -1,
   "CHANGE_USER_ID" Integer NOT NULL DEFAULT -1,
   "NAME" Varchar(254) ASCII NOT NULL DEFAULT '',
   PRIMARY KEY ("ID"),
   FOREIGN KEY "SYSUSER_CREATE_ID" ("CREATE_USER_ID")
     REFERENCES "SYSUSER" ("ID") ON DELETE SET DEFAULT,
   FOREIGN KEY "SYSUSER_CHANGE_ID" ("CHANGE_USER_ID")
     REFERENCES "SYSUSER" ("ID") ON DELETE SET DEFAULT
)
//

SaxDb says:
General error;-7040 POS(1) Referential constraint not allowed

Table Address has 2 foreign keys referencing into 1 table (delete rule is
SET NULL).
I don't understand reason why I can't define such FK.
It is posible only with delete rule is RESTRICT.

Dusan

--
Dusan Kolesar
Helsinska 19
040 13 Kosice
Slovakia
e-mail : d.kolesarcentrum.sk
ICQ# : 160507424

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