ERROR: column "x" of relation "y" already exists
ALTER TABLE ADD COLUMN for a column that’s already there.
Seen on:
PostgreSQL
Meaning
Usually a migration applied twice or manual schema changes.
Common causes
- Migration re-run
- Manual change not reflected in migrations
⚡ Quick fix
- Use ADD COLUMN IF NOT EXISTS
- Reconcile migration history
Detailed fix by platform
PostgreSQL
ALTER TABLE users ADD COLUMN IF NOT EXISTS last_login timestamptz;
How to diagnose
- Column — Already present (\d table)?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026