1661
MySQLERRORNotableInnoDBHIGH confidence

InnoDB full-text FTS_DOC_ID column has wrong definition

Production Risk

Low — DDL is rejected; table is not created.

What this means

The FTS_DOC_ID column used for InnoDB full-text search has an incorrect data type or attributes. It must be BIGINT UNSIGNED NOT NULL.

Why it happens
  1. 1FTS_DOC_ID is defined with a type other than BIGINT UNSIGNED.
  2. 2FTS_DOC_ID is nullable or has a different name casing.
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE articles (
  FTS_DOC_ID INT NOT NULL,
  body TEXT,
  FULLTEXT(body)
) ENGINE=InnoDB;

expected output

ERROR 1661 (HY000): Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index. Should be BIGINT UNSIGNED NOT NULL.

Fix

Define FTS_DOC_ID correctly

Define FTS_DOC_ID correctly
CREATE TABLE articles (
  FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  body TEXT,
  PRIMARY KEY (FTS_DOC_ID),
  FULLTEXT(body)
) ENGINE=InnoDB;

Why this works

Using BIGINT UNSIGNED NOT NULL for FTS_DOC_ID satisfies the InnoDB full-text requirement.

Sources
Official documentation ↗

MySQL 8.0 — 1661 ER_INNODB_FT_WRONG_DOCID_COLUMN

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

← All MySQL errors