DBAtlas · Database operations atlas

42710: duplicate_object

PostgreSQL

What does it mean?

The object being created (role, type, constraint, extension, schema, index name etc.) already exists. PostgreSQL does not allow a second object with the same name/definition.

Why does it happen?

A command such as CREATE ROLE, CREATE TYPE, CREATE EXTENSION or ADD CONSTRAINT ran while an object with the same name already existed. Usually caused by a script run twice, non-idempotent migrations, or two concurrent sessions trying to create the same object.

How to fix it

Check whether the object exists (pg_roles for roles, pg_type for types, pg_extension for extensions). Write migrations idempotently: use CREATE ... IF NOT EXISTS where available, or run DROP ... IF EXISTS first. For a constraint conflict, rename the existing constraint or drop and re-create it.

Open in DBAtlas →

More from this engine