1063
MariaDBERRORCommonDDLHIGH confidence

Incorrect column specifier for column

Production Risk

Low — DDL fails; no data loss.

What this means

ER_WRONG_FIELD_SPEC (1063, SQLSTATE 42000) is raised when an AUTO_INCREMENT attribute is applied to a column type that does not support it, such as FLOAT, CHAR, or BLOB.

Why it happens
  1. 1AUTO_INCREMENT applied to a non-integer column (FLOAT, VARCHAR, BLOB, etc.)
  2. 2DEFAULT expression is invalid for the column type
  3. 3Incorrect combination of column modifiers
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (name VARCHAR(50) AUTO_INCREMENT);

expected output

ERROR 1063 (42000): Incorrect column specifier for column 'name'

Fix

Use AUTO_INCREMENT only on integer columns

WHEN AUTO_INCREMENT is needed.

Use AUTO_INCREMENT only on integer columns
CREATE TABLE t (
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(50)
);

Why this works

AUTO_INCREMENT is only valid on integer types (INT, BIGINT, SMALLINT, TINYINT, MEDIUMINT) and must be a key.

What not to do

Use AUTO_INCREMENT on FLOAT columns

Floating-point AUTO_INCREMENT is not supported and produces 1063; use INT or BIGINT for surrogate keys.

Sources
Official documentation ↗

MySQL 8.0 — 1063 ER_WRONG_FIELD_SPEC

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

← All MariaDB errors