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.
book_isbnDROP CONSTRAINT book_isbn
Removed 1 constraint.
|
Constraints that are created as part of node or relationship element types in a graph type cannot be dropped with the
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.
{
"name": "actor_fullname"
}
DROP CONSTRAINT $name
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.
missing_constraint_nameDROP CONSTRAINT missing_constraint_name IF EXISTS
(no changes, no records)
`DROP CONSTRAINT missing_constraint_name IF EXISTS` has no effect. `missing_constraint_name` does not exist.