Knowledgebase

Understanding SQL Modes and Strictness Print

  • 0

How forgiving the database is.

WHAT A PERMISSIVE MODE DOES

Accepts invalid data with a warning, storing something approximate.

WHAT THAT PRODUCES

Truncated strings Zeroes where a date was invalid Values silently altered

WHY THAT IS DANGEROUS

Data is wrong, and nothing failed.

WHAT STRICT MODE DOES

Rejects the statement instead.

WHY THAT IS CORRECT

An error is recoverable; silently wrong data is not.

WHAT TO ENABLE

Strict mode, and the related settings that reject invalid dates and division by zero.

WHAT ELSE TO ENABLE

Strict grouping behaviour, so ambiguous queries are rejected.

WHY THAT ONE MATTERS

It prevents queries returning an arbitrary value from a group.

WHAT TO EXPECT ON ENABLING IT

Existing applications producing errors.

WHY THAT IS GOOD NEWS

Those errors were previously silent corruption.

WHAT TO DO

Enable it in development first, fix what breaks, then production.

WHAT TO CHECK ON AN INHERITED SYSTEM

Which modes are active.

HOW

Query the mode variable.

WHAT TO DOCUMENT

The intended modes, and keep environments matching.

WHAT TO BE CAREFUL WITH

Applications relying on permissive behaviour.

WHAT THAT INDICATES

Defects that have been masked.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot