EMZETT.
Login

Error 42P01: relation does not exist (PostgreSQL)

In short: The table or view in the query does not exist.

In more detail: PostgreSQL code 42P01 (undefined_table).

In Depth

Possible causes

  • Table not created, migration not run.
  • Wrong schema or database.
  • Upper/lower case with quotes.

Solutions

  1. Run migrations.
  2. Check schema and connection.
  3. Show existing tables with \dt.

See also: PostgreSQL, SQL, Database