Drop constraints

Constraints are dropped using the DROP CONSTRAINT command. It is possible to drop constraints created in a different Cypher® version than the one in use. For example, although VECTOR property type constraints were added in Cypher® 25, such constraints can still be dropped using Cypher 5.

For the full command syntax to drop constraints, see Syntax → Drop constraints. The constraints dropped on this page are created on the page Create constraints.

Dropping a constraint requires the DROP CONSTRAINT privilege.

Drop a constraint by name

A constraint can be dropped using the name with the DROP CONSTRAINT constraint_name command. It is the same command for all constraint types. The name of the constraint can be found using the SHOW CONSTRAINTS command, given in the output column name.

Example 1. Drop a constraint by name
Drop the constraint book_isbn
DROP CONSTRAINT book_isbn
Result
Removed 1 constraint.

Constraints that are created as part of node or relationship element types in a graph type cannot be dropped with the DROP CONSTRAINT constraint_name command. This includes the following constraints:

  • Property existence and property type constraints on identifying node labels or relationship types

  • Node label existence constraints

  • Relationship source and target label constraints

These constraints can only be dropped by dropping the full node or relationship element type. For more information, see Drop node and relationship element types.

Drop a constraint with a parameter

Constraints can be dropped with a parameterized name.

Example 2. Drop a constraint using a parameter
Parameters
{
  "name": "actor_fullname"
}
Drop a constraint with a parameterized name
DROP CONSTRAINT $name
Result
Removed 1 constraint.

Drop a non-existing constraint

If it is uncertain if any constraint with a given name exists and you want to drop it if it does but not get an error should it not, use IF EXISTS. This will ensure that no error is thrown. Instead, an informational notification is returned stating that the constraint does not exist.

Example 3. Drop a non-existing constraint
Drop the non-existing constraint missing_constraint_name
DROP CONSTRAINT missing_constraint_name IF EXISTS
Result
(no changes, no records)
Notification
`DROP CONSTRAINT missing_constraint_name IF EXISTS` has no effect. `missing_constraint_name` does not exist.