Informix Error -625
-625 Constraint name constraint-name already exists.
The constraint name already exists. Review the spelling. If it is as you intended, you must select another name, or drop and redefine the existing constraint. See the discussion of error -623 for a way to list all constraints.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-625 fires when a CONSTRAINT constraint-name clause names a constraint name that already
exists — constraint names must be unique, the same underlying rule behind -540's naming-collision
scenario, but hit directly as a naming clash rather than surfacing as a write failure.
- A constraint name reused across tables or duplicated by accident, per the official guidance — the direct, only cause.
- A copy-pasted
CONSTRAINTclause from another table's DDL, carrying over its constraint name without renaming it for the new context. - A migration script re-run without checking whether the constraint was already created under that name.
Solutions / Resolution
- Review the spelling of the constraint name, per the official guidance, in case it wasn't meant to collide.
- Select another name, per the official guidance, if the existing constraint under that name is meant to remain as-is.
- Or drop and redefine the existing constraint, per the official guidance, if the new definition is meant to replace it.
- List existing constraints to confirm what's already there, per the official guidance's
pointer to -623's documented query:
SELECT constrname, owner FROM informix.sysconstraints;
Examples
The name collision
ALTER TABLE orders ADD CONSTRAINT
CHECK (status IN ('pending','shipped')) CONSTRAINT ck_status;
-- ck_status already exists (possibly on a different table)
-- -625: Constraint name ck_status already exists.
Checking what's already there, then renaming
SELECT constrname, owner FROM informix.sysconstraints;
ALTER TABLE orders ADD CONSTRAINT
CHECK (status IN ('pending','shipped')) CONSTRAINT ck_orders_status;
Diagnostic Checks
- Run the official
sysconstraintsquery to confirm which name is already taken and by which table/owner.
Related Errors / Related Topics
- -540 — "Write failed on constraints." A related error, where a naming collision is one of several possible underlying causes of a more general write failure.
- -623 — "Unable to find CONSTRAINT constraint-name." The mirror-image situation: a
constraint name that can't be found, rather than one that's already taken. Shares the same
sysconstraintslisting query.
A straightforward naming collision — pick a unique name, or drop and redefine the existing constraint if replacement was actually intended.