1230
MariaDBERRORCriticalSyntax / VariablesHIGH confidence

Variable has no default value

Production Risk

Low — syntax error; no data affected.

What this means

ER_NO_DEFAULT (1230, SQLSTATE 42000) is raised when SET DEFAULT is used on a system variable that does not have a default value, or when an attempt is made to reset a variable that cannot be reset.

Why it happens
  1. 1Using SET variable = DEFAULT for a variable that has no defined default
  2. 2Attempting to reset a read-only or computed system variable
How to reproduce
trigger — this will error
trigger — this will error
SET SESSION some_var = DEFAULT;  -- if some_var has no default

expected output

ERROR 1230 (42000): Variable 'some_var' doesn't have a default value

Fix

Set the variable to an explicit value

Set the variable to an explicit value
SET SESSION sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_DATE';

Why this works

Always provide an explicit value instead of relying on DEFAULT for variables that lack one.

Sources
Official documentation ↗

MySQL 8.0 — 1230 ER_NO_DEFAULT

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

← All MariaDB errors