DBAtlas · Database operations atlas

42701: duplicate_column

PostgreSQL

What does it mean?

The same column name was used more than once in a table definition or ALTER operation, or an already existing column was added again.

Why does it happen?

Writing the same column name twice in CREATE TABLE; adding an already existing column with ALTER TABLE ADD COLUMN; a copy-paste mistake; a migration running again.

How to fix it

Remove or rename the duplicate column name in the table definition. Check first to avoid re-adding an existing column: \d table_name. Where the version supports it, add safely: ALTER TABLE my_table ADD COLUMN IF NOT EXISTS my_column type; Make sure migrations are idempotent.

Open in DBAtlas →

More from this engine