I have a bried question regarding foreign keys.
I'm attempting to add a foreign key constrain on a table such as in the example below. My problems is as follows:
The following two CREATE TABLE DDL commands succesfully create the foreign key and associated constraints:
e CREATE TABLE employee (
employee_id CHAR(10) UNIQUE PRIMARY KEY NOT NULL,
project_id CHAR(10) REFERENCES project (project_id) ON DELETE CASCADE,
emp_first_name CHAR(15),
emp_last_name CHAR(30),
emp_address_1 CHAR(50),
emp_address_2 CHAR(50),
....
emp_zip CHAR(9),
emp_age INT );
e CREATE TABLE employee (
employee_id CHAR(10) UNIQUE PRIMARY KEY NOT NULL,
project_id CHAR(10),
emp_first_name CHAR(15),
emp_last_name CHAR(30),
emp_address_1 CHAR(50),
emp_address_2 CHAR(50),
....
emp_zip CHAR(9),
emp_age INT ) FOREIGN KEY (project_id) REFERENCES project (project_id) ON DELETE CASCADE;
---------------------------------
HOWEVER THE LINE BELOW DOES NOT (according to the syntax outlined in the BNF in the accompanying documentation this SHOULD work):
e ALTER TABLE employee ADD FOREIGN KEY (project_id) REFERENCES project (project_id) ON DELETE CASCADE;
Is this a known bug or is something else wrong? Any help would be greatly appreciated.
Todd
-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.
|