1976
MariaDBERRORCommonConfigurationHIGH confidence

Variable has no default value

Production Risk

None — set statement is rejected.

What this means

SET variable = DEFAULT was used for a system variable that does not have a defined default value, making it impossible to reset to a default.

Why it happens
  1. 1SET SESSION sql_mode = DEFAULT when no compile-time default is defined for this variable.
  2. 2Attempting to reset a variable to DEFAULT when the variable has no DEFAULT.
How to reproduce
trigger — this will error
trigger — this will error
SET @@session.some_var = DEFAULT; -- if no default exists

expected output

ERROR 1976 (HY000): Variable 'some_var' does not have a default value.

Fix

Set the variable to an explicit value instead of DEFAULT

Set the variable to an explicit value instead of DEFAULT
SET SESSION sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';

Why this works

Specify the desired value explicitly when no DEFAULT is available.

Sources
Official documentation ↗

MySQL 8.0 — 1976 ER_NO_DEFAULT

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors