PostgreSQL error: relation "table_name" does not exist

PostgreSQL·Sep 12, 2026·beginner·
Quick answer

Your database doesn't have this table yet — either your migrations haven't run against this database, or you're pointing at the wrong database/schema entirely. Run `npx prisma migrate deploy` (or `migrate dev` locally) to sync the schema.

What causes this error

PostgreSQL is case-sensitive and schema-aware under the hood — this error almost always means the table genuinely isn't there in the database you're connected to, not a typo in your query (Prisma generates correct SQL).

The Fix

# Locally
npx prisma migrate dev

# In production/CI
npx prisma migrate deploy

If migrations have already run, double check `DATABASE_URL` — you may be pointed at a different database than the one you migrated (very common when juggling local, staging, and production connection strings).

Common causes / variations

  • Deploying code before running `prisma migrate deploy` on the production database
  • Working against a fresh Neon branch/project that never had migrations applied
  • Table name mismatch between `@@map()` in your schema and what you're querying manually

Related errors

See also: password authentication failed, migrate dev drift detected.

Was this fix helpful?

Comments

Loading comments...