Oracle 5.0 Reference Manual page 1065

Table of Contents

Advertisement

operations. However, even if
of a foreign key constraint where a column references a nonmatching column type. Also, if a table has
foreign key constraints,
To change the storage engine, you must drop any foreign key constraints first.
You cannot issue
do
SET foreign_key_checks =
statement used to create that table are also dropped.
If you re-create a table that was dropped, it must have a definition that conforms to the foreign key
constraints referencing it. It must have the correct column names and types, and it must have indexes
on the referenced keys, as stated earlier. If these are not satisfied, MySQL returns Error 1005 and
refers to Error 150 in the error message, which means that a foreign key constraint was not correctly
formed. Similarly, if an
would be incorrectly formed for the altered table.
For
InnoDB
in the MySQL Server, by checking the output of
13.1.10.3. Silent Column Specification Changes
In some cases, MySQL silently changes column specifications from those given in a
ALTER TABLE
type, or to an index specification.
All changes are subject to the internal row-size limit of 65,535 bytes, which may cause some attempts
at data type changes to fail. See
Some silent column specification changes include modifications to attribute or index specifications:
CREATE TABLE
foreign_key_checks = 0
ALTER TABLE
for a table that is referenced by a
DROP TABLE
ALTER TABLE
tables, you can obtain a detailed explanation of the most recent
Important
For users familiar with the ANSI/ISO SQL Standard, please note that no storage
engine, including InnoDB, recognizes or enforces the
referential-integrity constraint definitions. Use of an explicit
not have the specified effect, and also causes
clauses to be ignored. For these reasons, specifying
The
clause in the SQL standard controls how
MATCH
composite (multiple-column) foreign key are handled when comparing to a
primary key. MySQL essentially implements the semantics defined by
SIMPLE, which permit a foreign key to be all or partially NULL. In that case,
the (child table) row containing such a foreign key is permitted to be inserted,
and does not match any row in the referenced (parent) table. It is possible to
implement other semantics using triggers.
Additionally, MySQL requires that the referenced columns be indexed for
performance reasons. However, the system does not enforce a requirement that
the referenced columns be
foreign key references to nonunique keys or keys that contain
not well defined for operations such as
advised to use foreign keys that reference only
and
keys.
NOT NULL
Furthermore, MySQL does not recognize or support "inline
specifications" (as defined in the SQL standard) where the references are
defined as part of the column specification. MySQL accepts
clauses only when specified as part of a separate
For storage engines that do not support foreign keys (such as MyISAM), MySQL
Server parses and ignores foreign key specifications.
statement. These might be changes to a data type, to attributes associated with a data
Section E.7.4, "Limits on Table Column Count and Row
Syntax
cannot be used to alter the table to use another storage engine.
0. When you drop a table, any constraints that were defined in the
fails due to Error 150, this means that a foreign key definition
SHOW ENGINE INNODB
or be declared
UNIQUE
UPDATE
1045
[451], MySQL does not permit the creation
constraint, unless you
FOREIGN KEY
InnoDB
STATUS.
clause used in
MATCH
MATCH
and
ON DELETE
should be avoided.
MATCH
values in a
NULL
NULL. The handling of
NOT
NULL
or
CASCADE. You are
DELETE
(including PRIMARY)
UNIQUE
REFERENCES
REFERENCES
FOREIGN KEY
foreign key error
clause will
ON UPDATE
MATCH
values is
specification.
or
CREATE TABLE
Size".

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents