sqlstreak

SQL error

INSERT has more expressions than target columns / table has 4 columns but 5 values were supplied

Updated · Tested on PostgreSQL 18.6 and SQLite 3.54.1 (results generated , re-checked on every release)

Short answer

The number of values doesn't match the number of columns. Name the columns you're filling, INSERT INTO customers (id, name, city, joined_on) VALUES (…), and give exactly one value per named column.

The exact messages

  • PostgreSQLERROR: INSERT has more expressions than target columns
  • SQLitetable customers has 4 columns but 5 values were supplied

How to read this message

This is what PostgreSQL 18.6 prints for the broken query below, the way psql shows it. LINE gives the line it was reading when it gave up, and the ^ marks the exact spot.

ERROR:  INSERT has more expressions than target columns
LINE 2: VALUES (99, 'Ann Lee', 'Oslo', '2026-03-01', 'VIP');
                                                     ^

SQLite 3.54.1 reports the same mistake as table customers has 4 columns but 5 values were supplied, with no line number: look for the word or column it names.

Why it happens

One value too many

An extra value with nowhere to go, often a column you thought the table had. Check the table's columns before inserting.

No column list

INSERT INTO t VALUES (…) must supply every column in table order. Naming the columns makes the statement survive the day someone adds a column.

Too few values

SQLite rejects too few values too. PostgreSQL fills missing trailing columns with their defaults instead, which then trips a NOT NULL constraint if the column has no default.

Reproduce it, then fix it

Both queries run on a real database in your browser. Switch dialects to compare.

Broken
INSERT INTO customers
VALUES (99, 'Ann Lee', 'Oslo', '2026-03-01', 'VIP');
SELECT * FROM customers WHERE id = 99;
Fixed
INSERT INTO customers (id, name, city, joined_on)
VALUES (99, 'Ann Lee', 'Oslo', '2026-03-01');
SELECT * FROM customers WHERE id = 99;

Four named columns, four values. The run is rolled back afterwards, so the sample data stays as it was.

The fix returns, PostgreSQL: 1 row

idnamecityjoined_on
99Ann LeeOslo2026-03-01

The fix returns, SQLite: 1 row

idnamecityjoined_on
99Ann LeeOslo2026-03-01

Experiment with it: PostgreSQL playground·SQLite playground

Other forms of this mistake

Each one was run when this page was built; the result is what the engine really does.

  • INSERT INTO customers (id, name) VALUES (99, 'Ann Lee', 'Oslo');
    SELECT 1;

    SQLite3 values for 2 columns

    With a column list, SQLite words it differently.

  • INSERT INTO customers VALUES (99, 'Ann Lee');
    SELECT 1;

    SQLitetable customers has 4 columns but 2 values were supplied

    Too few values fail in SQLite as well.

  • INSERT INTO customers VALUES (99, 'Ann Lee');
    SELECT 1;

    PostgreSQLERROR: null value in column "city" of relation "customers" violates not-null constraint

    PostgreSQL accepts too few values and fills the rest with defaults; here city has none and is NOT NULL.

Official documentation

Stop hitting this error

Practise the concept behind it in a five-minute lesson, or read the full guide: SQL INSERT, UPDATE and DELETE.