(mysql.info.gz) Constraints
Info Catalog
(mysql.info.gz) Differences from ANSI
(mysql.info.gz) Compatibility
(mysql.info.gz) Bugs
1.5.6 How MySQL Deals with Constraints
--------------------------------------
MySQL allows you to work both with transactional tables that allow
rollback and with non-transactional tables that do not. Because of this,
constraint handling is a bit different in MySQL than in other databases.
We must handle the case when you have inserted or updated a lot of rows
in a non-transactional table for which changes cannot be rolled back
when an error occurs.
The basic philosophy is that MySQL Server tries to produce an error for
anything that it can detect while parsing a statement to be executed,
and tries to recover from any errors that occur while executing the
statement. We do this in most cases, but not yet for all. TODO
future.
The options MySQL has when an error occurs are to stop the statement in
the middle or to recover as well as possible from the problem and
continue. By default, the server follows the latter course. This
means, for example, that the server may coerce illegal values to the
closest legal values.
Beginning with MySQL 5.0.2, several SQL mode options are available to
provide greater control over how accepting to be of bad data values and
whether to continue executing a statement or abort it when errors
occur. Using these options, you can configure MySQL Server to act in a
more traditional fashion that is like other DBMSs that reject improper
input. The SQL mode can be set at runtime, which enables individual
clients to select the behavior most appropriate for their requirements.
Server SQL mode.
The following sections describe what happens for the different types of
constraints.
Menu
* constraint primary key `PRIMARY KEY' and `UNIQUE' Index Constraints
* constraint invalid data Constraints on Invalid Data
* constraint enum `ENUM' and `SET' Constraints
Info Catalog
(mysql.info.gz) Differences from ANSI
(mysql.info.gz) Compatibility
(mysql.info.gz) Bugs
automatically generated byinfo2html