MySQL works with both transactional tables that permit rollback and nontransactional tables that do not, so constraint handling differs from other DBMSs. The server's philosophy is to raise an error for anything it can detect while parsing a statement and to recover as well as possible from errors that occur during execution. When an execution error occurs, the options are to stop the statement in the middle or to recover and continue; by default the server continues, which means it may coerce an invalid value to the closest valid value. SQL mode options give greater control over handling bad data values and over whether execution continues or aborts on error, letting you configure the server to reject improper input like more traditional DBMSs. The SQL mode can be set globally at server startup for all clients, or by individual clients at runtime. Constraint types covered include PRIMARY KEY and UNIQUE index constraints, FOREIGN KEY constraints, and ENUM and SET constraints. Choosing a strict SQL mode so bad data is rejected rather than coerced is Koskamo editorial guidance. Scope: MySQL 8.4. Reviewed October 4, 2026.
Constraint handling and SQL modes
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- dev.mysql.com
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.