Unable to create and delete a node in the same transaction with the REST API #2074

Open
growak opened this Issue Mar 2, 2014 · 5 comments

3 participants

@growak

4 requests are sent the REST transactional endpoint :

  • A transaction creation request
  • A create node request
  • A delete node request
  • A read node request

The last request return a node whereas it as been deleted in the current transaction.
Is that a bug or a desired behavior ? Do I need to commit the transaction to effectively delete the node and read the node by i in an other transaction ?

request: {"statements":[]}
response: {"commit":"http://localhost:7475/db/data/transaction/1/commit","results":[],"transaction":{"expires":"Sun, 02 Mar 2014 18:48:11 +0000"},"errors":[]}
request: {"statements":[{"statement":"CREATE (vertex {properties}) RETURN ID(vertex), LABELS(vertex), vertex","parameters":{"properties":{}},"resultDataContents":[]}]}
response: {"commit":"http://localhost:7475/db/data/transaction/1/commit","results":[{"columns":["ID(vertex)","LABELS(vertex)","vertex"],"data":[{"row":[0,[],{}]}]}],"transaction":{"expires":"Sun, 02 Mar 2014 18:48:13 +0000"},"errors":[]}
request: {"statements":[{"statement":"START vertex=node({vertexId}) MATCH vertex DELETE vertex","parameters":{"vertexId":0},"resultDataContents":[]}]}
response: {"commit":"http://localhost:7475/db/data/transaction/1/commit","results":[{"columns":[],"data":[]}],"transaction":{"expires":"Sun, 02 Mar 2014 18:48:13 +0000"},"errors":[]}
request: {"statements":[{"statement":"MATCH vertex WHERE (ID(vertex) = 0) RETURN ID(vertex), LABELS(vertex), vertex","parameters":{},"resultDataContents":[]}]}
response: {"commit":"http://localhost:7475/db/data/transaction/1/commit","results":[{"columns":["ID(vertex)","LABELS(vertex)","vertex"],"data":[{"row":[0,[],{}]}]}],"transaction":{"expires":"Sun, 02 Mar 2014 18:48:13 +0000"},"errors":[]}
@jakewins
Neo4j member

@growak this is not desired behavior, and should not occur. I believe the issue is that the node id is hard-coded to 0 in the last query though? Can you verify that if you change the last query from

MATCH vertex WHERE (ID(vertex) = 0) RETURN ID(vertex), LABELS(vertex), vertex

To

MATCH vertex WHERE ID(vertex) = {vertexId} RETURN ID(vertex), LABELS(vertex), vertex

That the problem remains?

If it does persist, which version of Neo4j are you running?

@growak
@jakewins
Neo4j member

@growak which version of Neo4j are you using?

@growak
@jakewins
Neo4j member

@growak if you have a piece of code that replicates it, that'd be awesome. We'll put this in the backlog in the mean time and look into it.

@davidegrohmann davidegrohmann removed the server label Oct 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment