sqlstreak

SQL error

column "nme" of relation "pets" does not exist / table pets has no column named nme

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

Short answer

INSERT or UPDATE names a column the table doesn't have: a typo, a column that was never created, or the wrong table. List the table's columns and use their exact names.

The exact messages

  • PostgreSQLERROR: column "nme" of relation "pets" does not exist
  • SQLitetable pets has no column named nme

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:  column "nme" of relation "pets" does not exist
LINE 1: INSERT INTO pets (id, nme, species, age, weight_kg, adopted, arrived_on)
                              ^

SQLite 3.54.1 reports the same mistake as table pets has no column named nme, with no line number: look for the word or column it names.

Why it happens

A typo in the column list

INSERT INTO pets (nme): the table has name.

The column was never added

Code expects a column a migration should have created. Add it with ALTER TABLE, or drop it from the statement.

Capitals in quotes

A column created as "Name" must be written that way. Plain name won't match it in PostgreSQL.

Reproduce it, then fix it

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

Broken
INSERT INTO pets (id, nme, species, age, weight_kg, adopted, arrived_on)
VALUES (21, 'Tango', 'dog', 2, 12.5, false, '2026-11-17');
SELECT 1;
Fixed
INSERT INTO pets (id, name, species, age, weight_kg, adopted, arrived_on)
VALUES (21, 'Tango', 'dog', 2, 12.5, false, '2026-11-17');
SELECT id, name, species FROM pets WHERE id = 21;

With the real column name, the row goes in (and the run is rolled back afterwards).

The fix returns, PostgreSQL: 1 row

idnamespecies
21Tangodog

The fix returns, SQLite: 1 row

idnamespecies
21Tangodog

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.

  • UPDATE pets SET nme = 'Tango' WHERE id = 1;
    SELECT 1;

    PostgreSQLERROR: column "nme" of relation "pets" does not exist

    UPDATE gets the same message.

  • UPDATE pets SET nme = 'Tango' WHERE id = 1;
    SELECT 1;

    SQLiteno such column: nme

    SQLite words it differently for UPDATE.

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.