|
Posted by Daedalus.OS on 10/08/05 23:34
Currently MySQL doesn't apply the constraints unless your using InnoDB.
From MySQL Reference Manual:
"In MySQL Server 3.23.44 and up, the InnoDB storage engine supports checking
of foreign key constraints, including CASCADE, ON DELETE, and ON UPDATE. See
Section 15.7.4, "FOREIGN KEY Constraints".
For storage engines other than InnoDB, MySQL Server parses the FOREIGN KEY
syntax in CREATE TABLE statements, but does not use or store it. In the
future, the implementation will be extended to store this information in the
table specification file so that it may be retrieved by mysqldump and ODBC.
At a later stage, foreign key constraints will be implemented for MyISAM
tables as well. "
"thehuby" <thehuby@gmail.com> wrote in message
news:1128689074.556999.50760@o13g2000cwo.googlegroups.com...
> Can anyone help me define the syntax for creating compound keys in
> mysql?
>
> I want to have a pair of foreign keys as a compound primary key in a
> table.
>
> Also - can anyone tell me if MySQL supports foreign key constraints
> correctly? I have written the SQL for them and even added it to the
> database successfully, but it doesn't seem to stop me adding whatever
> values I want to into the fields. Someone mentioned innoDB or
> something but I am not sure what it is.
>
> MySQL syntax for the table in question is below:
>
> CREATE TABLE authorisation_config (
> fk_user_id INT(3) NOT NULL, /* FK user */
> fk_website_section_id INT(3) NOT NULL, /* FK website_section */
> auth_type ENUM ("contributor", "approver", "contributor/approver" )
> NOT NULL DEFAULT 1
> );
>
> Regards,
>
> Rick
>
[Back to original message]
|