[Bug] with long data type insertion in Neo4j

I have installed Neo4J 4.1 community edition in the Linux box and accessing the database remotely in the browser using the URL - http://10.10.10.10:8474/browser/

Please note: I have updated default binding ports to [8474 (HTTP) 8473 (HTTPS) and 8467 (Bolt)] from Neo4J configuration file.

I think there is a bug in the Neo4J version 4.1 while dealing with Long data types. I tried inserting below statement in Version 4.1 and Version 3.5,

Neo4J 4.1

MERGE (POINT: TEST1 {myRandomValue: 1594633221523})

Outcome:
{
"identity": 251,
"labels": [
"TEST1"
],
"properties": {
"myRandomValue": 1200354707
}
}

While Executing same statement in Neo4J 3.5

MERGE (POINT: TEST1 {myRandomValue: 1594633221523})

Outcome:
{
"identity": 251,
"labels": [
"TEST1"
],
"properties": {
"myRandomValue": 1594633221523
}
}

So in Neo4J 4.1 Long value is losing the precision and this is a major problem. Can we please have a workaround / fix for the issue as I do not want data to be stored as string due to further cypher requirements.

Regards,
Maulik

I've just tried this and could not reproduce it. Using the very same MERGE command above I do get back the correct and expected value of 1594633221523.

Do you have an index/unique constraint on TEST1(myRandomValue)? In case the index is inconsistent it could explain the wrong behaviour of merge.

Can you please retry on a new empty database?

Hi Stefan,
Which version you tried with ? I am trying with neo4j-community-4.1.0 linux build.

This is very basic insertion and I have tried with random nodes and properties also so I assume index or constraint should be out of question.

I have still cross checked using "CALL db.indexes()" and "CALL db.constraints()" and both returned "(no changes, no records)" so I can assure that there are no index or constraints applied. checking on empty database may not help as I have plenty of data loaded in neo4j db.

I also tried - create (POINT: TEST3 {myRandomValue: 1594633221523})
Result: MATCH (n:TEST3) RETURN n LIMIT 25
{
"identity": 253,
"labels": [
"TEST3"
],
"properties": {
"myRandomValue": 1200354707
}
}

and
create (:TEST4 {myRandomValue: 1594633221523})
Result: MATCH (n:TEST4) RETURN n LIMIT 25
{
"identity": 254,
"labels": [
"TEST4"
],
"properties": {
"myRandomValue": 1200354707
}
}

Regards,
Maulik

One more thing to highlight I am trying to add timestamp long value and I believe it's getting transfromed to default timestamp value. Could there be anything around that creating problem ?

Can you please provide a script starting with an empty database showing the wrong behaviour from scratch (aka from an empty database).

If you're doing MATCH (t:TEST3) RETURN t limit 25 you're not guaranteed you get back the nodes you've created previously. You just get 25 nodes back.

Hi @stefan.armbruster ,

I sincerely thank you for time you are spending in analyzing the problem.

On a trial run I insterted single value for the node with property and the problem persists. Considering there is a single value limit to 25 is not a problem. I am not sure why you are not able to recreate the issue as I am able to recreate the issue even with fresh installation for the same version - community 4.1.0 for both linux and windows.

No constraint, no index, just download fresh community 4.1.0 version from the Neo4J website, install and start DB with "neo4j.bat console" / or "./neo4j.sh console", open browser (I am using chrome version: 84.0.4147.89, 64-bit) and access DB with HTTP URL (http://xx.xx.x.xxx:8474/browser/) and then execute insertion and match script. the value inserted having timestamp as long value is incorrect.

You may try creating any random node by insterting timestamp value as long / int value, for example: MERGE (POINT: TEST3 {myRandomValue: 1595483248612})
and then match to get the result,
MATCH (t:TEST3) RETURN t

I have time being instered value as String and I am using toInteger() while comparing the value as a workaround, however this is a temporary work around and proper resolution is definitely required before production or enterprise consideration.

Regards,
Maulik

@stefan.armbruster
I have installed latest community version 4.1.1 and tried and the problem exists even with 4.1.1 community version. Please see attached.

Regards,
Maulik

On an empty enterprise 4.1.0 I've tried to run the commands you've provided

MERGE (POINT: TEST3 {myRandomValue: 1595483248612})

and

MATCH (t:TEST3) RETURN t

I'm getting back the expected value:image
So not really reproducible.

Hey, @maulik.v.kayastha @stefan.armbruster I was able to reproduce the same on our production Neo4j Enterprise 3.5.19.

We are trying to store timestamp() but it doesn't seem to accept long numbers.

Did you find out anything else about this issue?

After further testing, it looks like it is fully related to JS and the web interface.

When running through the command line data is returned correctly:

neo4j@<default_database>> MATCH (t:TEST3) RETURN t;
+-----------------------------------------+
| t                                       |
+-----------------------------------------+
| (:TEST3 {myRandomValue: 1595483248612}) |
+-----------------------------------------+
1 row available after 5 ms, consumed after another 1 ms