Show constraints
To list all constraints with the default output columns, use SHOW CONSTRAINTS.
If all columns are required, use SHOW CONSTRAINTS YIELD *.
For the full command syntax to list constraints, see Syntax → Show constraints.
The constraints listed on this page are created on the page Create constraints.
|
All constraints created when setting a graph type will be returned by the |
One of the output columns from SHOW CONSTRAINTS is the name of the constraint.
This can be used to drop the constraint with the DROP CONSTRAINT command.
Listing constraints requires the SHOW CONSTRAINTS privilege.
|
SHOW CONSTRAINTS
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name | type | entityType | labelsOrTypes | properties | enforcedLabel | ownedIndex | propertyType |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 28 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | NULL | "actor_fullname" | NULL |
| 27 | "author_name" | "NODE_PROPERTY_EXISTENCE" | "NODE" | ["Author"] | ["name"] | NULL | NULL | NULL |
| 34 | "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["isbn"] | NULL | "book_isbn" | NULL |
| 23 | "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["title", "publicationYear"] | NULL | "book_title_year" | NULL |
| 36 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | NULL | "director_imdbId" | NULL |
| 26 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | NULL | "knows_since_how" | NULL |
| 12 | "movie_tagline" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["tagline"] | NULL | NULL | "STRING | LIST<STRING NOT NULL>" |
| 33 | "movie_title" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["title"] | NULL | NULL | "STRING" |
| 17 | "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["prop1"] | NULL | "node_uniqueness_param" | NULL |
| 2 | "node_vector_constraint" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["embedding"] | NULL | NULL | "VECTOR<INTEGER32 NOT NULL>(42)" |
| 38 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | NULL | "ownershipId" | NULL |
| 41 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | NULL | "INTEGER" |
| 39 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | NULL | "STRING | LIST<STRING NOT NULL>" |
| 24 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | NULL | "prequels" | NULL |
| 30 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | NULL |
| 3 | "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["CONTAINS"] | ["embedding"] | NULL | NULL | "VECTOR<FLOAT32 NOT NULL>(1536)" |
| 19 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | NULL | "sequels" | NULL |
| 14 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | NULL |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
To return the full details of the constraints on a database, use SHOW CONSTRAINTS YIELD *
YIELD *SHOW CONSTRAINTS YIELD *
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name | type | entityType | labelsOrTypes | properties | enforcedLabel | classification | ownedIndex | propertyType | options | createStatement |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 28 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | NULL | "undesignated" | "actor_fullname" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS KEY" |
| 27 | "author_name" | "NODE_PROPERTY_EXISTENCE" | "NODE" | ["Author"] | ["name"] | NULL | "independent" | NULL | NULL | NULL | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL" |
| 34 | "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["isbn"] | NULL | "undesignated" | "book_isbn" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE" |
| 23 | "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["title", "publicationYear"] | NULL | "undesignated" | "book_title_year" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE" |
| 36 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | NULL | "undesignated" | "director_imdbId" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS KEY" |
| 26 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | NULL | "undesignated" | "knows_since_how" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS KEY" |
| 12 | "movie_tagline" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["tagline"] | NULL | "independent" | NULL | "STRING | LIST<STRING NOT NULL>" | NULL | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST<STRING NOT NULL>" |
| 33 | "movie_title" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["title"] | NULL | "independent" | NULL | "STRING" | NULL | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING" |
| 17 | "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["prop1"] | NULL | "undesignated" | "node_uniqueness_param" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE" |
| 2 | "node_vector_constraint" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["embedding"] | NULL | "independent" | NULL | "VECTOR<INTEGER32 NOT NULL>(42)" | NULL | "CREATE CONSTRAINT `node_vector_constraint` FOR (n:`Movie`) REQUIRE (n.`embedding`) IS :: VECTOR<INTEGER32 NOT NULL>(42)" |
| 38 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | NULL | "undesignated" | "ownershipId" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS KEY" |
| 41 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "independent" | NULL | "INTEGER" | NULL | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER" |
| 39 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "independent" | NULL | "STRING | LIST<STRING NOT NULL>" | NULL | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST<STRING NOT NULL>" |
| 24 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | NULL | "undesignated" | "prequels" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE" |
| 30 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | "independent" | NULL | NULL | NULL | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL" |
| 3 | "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["CONTAINS"] | ["embedding"] | NULL | "independent" | NULL | "VECTOR<FLOAT32 NOT NULL>(1536)" | NULL | "CREATE CONSTRAINT `rel_vector_constraint` FOR ()-[r:`CONTAINS`]-() REQUIRE (r.`embedding`) IS :: VECTOR<FLOAT32 NOT NULL>(1536)" |
| 19 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | NULL | "undesignated" | "sequels" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE" |
| 14 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | "independent" | NULL | NULL | NULL | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL" |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Listing constraints with filtering
The SHOW CONSTRAINTS command can be filtered in various ways.
The filtering of rows can be done using constraint type keywords or a WHERE clause, while filtering of columns is achieved by specifying the desired columns in a YIELD clause.
SHOW KEY CONSTRAINTS
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name | type | entityType | labelsOrTypes | properties | enforcedLabel | ownedIndex | propertyType |
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 28 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | NULL | "actor_fullname" | NULL |
| 36 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | NULL | "director_imdbId" | NULL |
| 26 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | NULL | "knows_since_how" | NULL |
| 38 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | NULL | "ownershipId" | NULL |
+------------------------------------------------------------------------------------------------------------------------------------------------------------+
For a full list of all the constraint types (and synonyms) available in this command see Syntax → SHOW CONSTRAINTS.
WHERE clauseRELATIONSHIP entityTypeSHOW CONSTRAINTS
WHERE entityType = 'RELATIONSHIP'
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | name | type | entityType | labelsOrTypes | properties | enforcedLabel | ownedIndex | propertyType |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 26 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | NULL | "knows_since_how" | NULL |
| 38 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | NULL | "ownershipId" | NULL |
| 41 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | NULL | "INTEGER" |
| 39 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | NULL | "STRING | LIST<STRING NOT NULL>" |
| 24 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | NULL | "prequels" | NULL |
| 30 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | NULL |
| 3 | "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["CONTAINS"] | ["embedding"] | NULL | NULL | "VECTOR<FLOAT32 NOT NULL>(1536)" |
| 19 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | NULL | "sequels" | NULL |
| 14 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | NULL |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
It is possible to return only specific columns of the available constraints using the YIELD clause:
name, type, and createStatement columnsSHOW CONSTRAINTS
YIELD name, type, createStatement
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | type | createStatement |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| "actor_fullname" | "NODE_KEY" | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS KEY" |
| "author_name" | "NODE_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL" |
| "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE" |
| "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE" |
| "director_imdbId" | "NODE_KEY" | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS KEY" |
| "knows_since_how" | "RELATIONSHIP_KEY" | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS KEY" |
| "movie_tagline" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST<STRING NOT NULL>" |
| "movie_title" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING" |
| "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE" |
| "node_vector_constraint" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `node_vector_constraint` FOR (n:`Movie`) REQUIRE (n.`embedding`) IS :: VECTOR<INTEGER32 NOT NULL>(42)" |
| "ownershipId" | "RELATIONSHIP_KEY" | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS KEY" |
| "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER" |
| "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST<STRING NOT NULL>" |
| "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE" |
| "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL" |
| "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `rel_vector_constraint` FOR ()-[r:`CONTAINS`]-() REQUIRE (r.`embedding`) IS :: VECTOR<FLOAT32 NOT NULL>(1536)" |
| "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE" |
| "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL" |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Result columns for listing constraints
| Column | Description | Type |
|---|---|---|
|
The id of the constraint. Default Output |
|
|
Name of the constraint (explicitly set by the user or automatically assigned). Default Output |
|
|
The ConstraintType of this constraint ( |
|
|
Type of entities this constraint represents ( |
|
|
The labels or relationship types of this constraint. The list returned will only include a single value (the name of the constrained node label or relationship type). Default Output |
|
|
The properties of this constraint, or |
|
|
The implied labels required by a node label existence constraint or the source node and target node labels required by a relationship source or target label constraint, or |
|
|
The name of the index associated with the constraint or |
|
|
The property type the property is restricted to for property type constraints, or |
|
|
The status of a constraint in a graph type ( |
|
|
The options passed to |
|
|
Statement used to create the constraint, or |
|