age icon indicating copy to clipboard operation
age copied to clipboard

Unexpected Error: argument 1 must not be null

Open DominicWuest opened this issue 1 year ago • 6 comments

When running the following query:

MERGE () MERGE n0 = ()

I encountered the following error:

pq: argument 1 must not be null

I believe the query mentioned above is semantically and syntactically correct and thus no error should be thrown here. Additionally, the query runs successfully in neo4j.

I encountered this issue when testing queries against the apache/age:PG13_latest docker image.

Steps to reproduce

Run the following query and observe it throws an error:

MERGE () MERGE n0 = ()

Expected behavior

The query should run successfully

Actual behavior

The query fails with the error message argument 1 must not be null.

DominicWuest avatar Apr 30 '23 20:04 DominicWuest

Can you share the complete query you are writing along with a screenshot of your terminal for better diagnosis? Also make sure you have imported AGE correctly and you are able to run other queries

humzakt avatar May 04 '23 17:05 humzakt

The merge syntax is this one: MERGE (n:Label {property: value})

You must need to enter the vertex details to run the query.

From Documentation, merge is being used in this way

SELECT * FROM cypher('graph_name', $$ MERGE (charlie {name: 'Charlie Sheen', age: 10}) RETURN charlie $$) as (v agtype);

For detailed information, you can see this documentation: Merge Documentation

waleedahmed0001 avatar May 12 '23 06:05 waleedahmed0001

The issue you are encountering might be due to the differences between Neo4j and Apache AGE. Apache AGE currently does not support all the features and syntax that Neo4j supports.

The MERGE statement you are trying to run is not specifying any node labels or properties. In Neo4j, MERGE () is valid and it matches or creates a node without any labels or properties. However, in Apache AGE, this is not the case.

Have a look at the docs for MERGE

safi50 avatar Jun 02 '23 11:06 safi50

Thanks for looking into this @safi50 and @waleedahmed0001. However, this doesn't seem like it solves the problem. Removing the n0 identifier in the query lets the query run successfully. Additionally, adding labels and properties to the two nodes still produces the same error. It seems like the documentation is out of date, since MERGE () is a valid query in the newest release of apache AGE and creates a single node.

DominicWuest avatar Jun 02 '23 11:06 DominicWuest

@DominicWuest Please test against the master branch, if possible, as it has a lot of updates that haven't been migrated to the other branches.

jrgemignani avatar Jun 02 '23 14:06 jrgemignani

This issue is stale because it has been open 45 days with no activity. Remove "Abondoned" label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 11 '24 00:05 github-actions[bot]

@DominicWuest I believe this is no longer an issue -

psql-16.2-5432-pgsql=# select * from cypher('test', $$ MERGE () MERGE n0 = () $$) as (result agtype);                                result
--------
(0 rows)

psql-16.2-5432-pgsql=#

Please check against the latest DH releases.

jrgemignani avatar May 24 '24 00:05 jrgemignani

Issue was resolved

jrgemignani avatar May 25 '24 00:05 jrgemignani