Unique constraint not getting respected

30 views
Skip to first unread message

varun kumar

unread,
Oct 4, 2015, 1:17:06 AM10/4/15
to Neo4j

I have created a neo4j DB locally and assigned some indices and unique constraint.

Here is the :schema

Indexes
  ON :Actor(social_id) ONLINE (for uniqueness constraint) 
  ON :Category(name)   ONLINE (for uniqueness constraint) 

Constraints
  ON (actor:Actor) ASSERT actor.social_id IS UNIQUE
  ON (category:Category) ASSERT category.name IS UNIQUE

Additionally I do a createIfNotFound() in my java code, where I first do a find and then create if not found.

Inspite of these two checks I still see multiple nodes of Label category and same name existing in the DB.

 MATCH (n:Category) WHERE n.name='garden' RETURN n

name    garden
name    garden
name    garden
name    garden
Returned 4 rows in 49 ms.

I am not sure what I am missing, and why is the unique constraint not being honored.


Would appreciate any pointers to debug.


Thanks

Varun

Mattias Persson

unread,
Oct 5, 2015, 6:34:12 AM10/5/15
to Neo4j
Hi,

That definitely sounds worrying and unexpected. If you could make available code to reproduce this it would be most helpful.

varun kumar

unread,
Oct 5, 2015, 3:25:24 PM10/5/15
to ne...@googlegroups.com
Will surely bring up the old checkpoint and do exact steps to repro. Will be back in a day or so.
Thanks a lot for the interest and the response.

Thanks

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Varun Kumar 

Reply all
Reply to author
Forward
0 new messages