cancel
Showing results for 
Search instead for 
Did you mean: 

Query with CALL {} IN TRANSACTION fails on different platforms

paolodipietro58
Graph Voyager

Running Neo4j Community Edition 4.4.6
on UBUNTU 22.04 under PARALLELS on a MACBOOK PRO with M1 processor
and on UBUNTU 20.04 X64 bare metal

Good morning

I moved on a brand new MacBook Pro with M1 processor, running Parallels, then I created an Ubuntu VM and installed Neo4j using apt install neo4j. I also installed apoc and cypher-shell.

Everything seemed to run, but, when I ran my first query, it returned an error.

SELECT (n:Country)
CALL {
     WITH n DETACH DELETE n
} IN TRANSACTIONS; 

The first time I launched the query on an empty database, it ran.
The second time, when there was Country nodes, it failed with the following message:

Neo.DatabaseError.Statement.ExecutionFailed: a query with `CALL { ... } IN TRANSACTIONS` can only be executed in an implicit transaction, but tried to execute in an explicit transaction.

The problem is that the same query run everyday without problems on my old bare metal Ubuntu 20.04 machine

Any suggestion will be appreciated.

I have also another problem with the apple m1 silicon that I described in https://community.neo4j.com/t/neo4j-refuses-to-start-with-zulu-jvm/56213 where the neo4j manual gave wrong indications. Please, could someone check it too? Thank you in advance

Thank you!

5 REPLIES 5

glilienfield
Ninja
Ninja

Are the versions on your new Mac and the bare metal the same. I recall this behavior was changed. Try inserting :auto at the beginning of the query.

I guess you didn’t get an error when there was no data because the match return a null result and didn’t try to execute the call clause.

Yes, it is exactly so: with no data it didn't try to execute the call, and then doesn't fail.
It refuses :auto.
And, finally, both versions are 4.4.6

But I installed it directly on the machine, without Parallels. Here it accepts :auto

Now, I'm facing another trouble!

The query with ˆ:autoˆ runs nicely only in the browser, but if I run it using the ˆcypher-shellˆ(.4.4.6 - the same as the server!) it fails.

ˆˆˆ
Invalid input ':': expected (line 1, column 1 (offset: 0))
":auto MATCH (n:Address)"
^
ˆˆˆ
The query is:
ˆˆˆ
:auto MATCH (n:Address)
CALL {
WITH n
DETACH DELETE n
} IN TRANSACTIONS;

MATCH (n:AddressType)
CALL {
WITH n
DETACH DELETE n
} IN TRANSACTIONS;
ˆˆˆ
Please, note 3 things:

  1. if I remove ˆ:autoˆthe query doesn't run on ˆbrowserˆ but runs on ˆcypher-shellˆ

  2. if I add ˆ:autoˆ the query doesn't run on ¡cypher-shellˆbut runs on ˆbrowserˆ

  3. a curiosity: I showed you a query with two ˆcall {...} in transactionsˆ. Well, they are two queries separated by a semicolon. On the browser, only the first need ˆ:autoˆ while the second runs without it, and this is strange and curious.

glilienfield
Ninja
Ninja

It looks like the cypher shell and browser don’t have the same behavior. It looks like the cypher shell only supports explicit transactions, while the ‘call in transactions’ is only allowed in implicit transactions. I guess this means it does not work in the shell.

paolodipietro58
Graph Voyager

I think this is a thing that should be bring at the attention of the maintainer. I don't know how to.

In the meanwhile, I arranged to sed a script ....

sed -f ./001_import_all.sed $1 > temp | cypher-shell -f temp -u neo4j >> 001_import_all.log 2>> 001_import_all.log

and import_all.sed does the dirty work:
s/\(:auto\)//g

And this run with the call {} IN TRANSACTIONS even in the cypher-shell, despite the manual!

But this is only a patch ....