1399
MariaDBerrorqueryhigh confidence

Operand should contain N column(s)

Production Risk

Low — syntax/semantic error; query not executed.

What this means

A row value comparison used a subquery or tuple that returned a different number of columns than the left-hand operand expects.

Why it happens
  1. 1(a, b) IN (SELECT c FROM t) — right side has 1 column, left has 2
  2. 2Row constructor column count mismatch in EXISTS or IN subquery
How to reproduce
trigger — this will error
trigger — this will error
SELECT * FROM t WHERE (a, b) = (SELECT a FROM ref WHERE id = 1);

expected output

ERROR 1399 (HY000): Operand should contain 2 column(s)

Fix

Match column counts on both sides

Match column counts on both sides
SELECT * FROM t WHERE (a, b) = (SELECT a, b FROM ref WHERE id = 1);

Why this works

Both sides of the row comparison must have the same number of columns.

Sources
Official documentation ↗

MySQL 8.0 — 1399 ER_OPERAND_COLUMNS

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

← All MariaDB errors