Create constraint if not exists

Hi,

I am trying to run following cypher via Neo4j browser

CREATE CONSTRAINT test_id IF NOT EXISTS ON (n:Test) ASSERT n.id IS UNIQUE

it is giving following error

Invalid input 'I': expected whitespace, comment or ON (line 1, column 27 (offset: 26))
"CREATE CONSTRAINT test_id IF NOT EXISTS ON (n:Test) ASSERT n.id IS UNIQUE"

Thanks

@sethia.arun hi I think maybe you are running in the community edition and know those kind of sentences only works in enterprise edition Constraints - Cypher Manual

Thanks, yes I am using community edition.

I am getting the same error.

From reading that documentation it does seem like most constraints are limited to enterprise edition but not this "unique node property constraint". So this query should work in community edition?

Also, even if it was limited to enterprise edition, I am currently testing using neo4j desktop which afaik is equivalent to enterprise edition and should therefore work even then.

Ah I found this in the documentation for 4.1 (I'm running 4.1.0)

The IF [NOT] EXISTS syntax for constraints is only available in Neo4j 4.1.3 and onwards.