Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error when matching nodes that are connected to nodes resulted from a previous MATCH clause #1393

Closed
ns-hygao opened this issue Nov 13, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@ns-hygao
Copy link

Describe the bug
I simplified the Cypher query to do the following:

  1. MATCH nodes with Object label
  2. MATCH nodes that are connected with the nodes resulting from the previous query by any edge
  3. RETURN the nodes

How are you accessing AGE (Command line, driver, etc.)?

  • Command line inside psql client

What data setup do we need to do?
Minimal data setup:
postgresDB=# SELECT * FROM ag_catalog.create_graph('testgraph');
postgresDB=# SELECT * FROM cypher('testgraph', $$ CREATE (n1:Object) RETURN n1$$)
postgresDB=# SELECT * FROM cypher('testgraph', $$ MATCH (n1:Object)
MATCH (n2:Object)
WHERE EXISTS((n1)-[]->(n2))
RETURN n2 $$)
AS (n2 agtype);
ERROR: missing FROM-clause entry for table "n1"
LINE 1: SELECT * FROM cypher('testgraph', $$ MATCH (n1:Object)

What is the necessary configuration info needed?

What is the command that caused the error?
postgresDB=# SELECT * FROM cypher('testgraph', $$ MATCH (n1:Object)
MATCH (n2:Object)
WHERE EXISTS((n1)-[]->(n2))
RETURN n2 $$)
AS (n2 agtype);
ERROR: missing FROM-clause entry for table "n1"
LINE 1: SELECT * FROM cypher('testgraph', $$ MATCH (n1:Object)

Expected behavior
The query should succeed and return 0 rows.

Environment (please complete the following information):

  • Installed from docker image obtained from command command docker pull apache/age
  • Run using docker command docker run \ --name myPostgresDb \ -p 5455:5432 \ -e POSTGRES_USER=postgresUser \ -e POSTGRES_PASSWORD=postgresPW \ -e POSTGRES_DB=postgresDB \ -d \ apache/age
  • PostgreSQL version 15.4

Additional context

@ns-hygao ns-hygao added the bug Something isn't working label Nov 13, 2023
@jrgemignani
Copy link
Contributor

@ns-hygao Thank you for pointing out this bug, we will address it. I will point out, though, this particular command is the same as the following, which does work -

psql-15.4-5432-pgsql=# SELECT * FROM cypher('testgraph', $$ MATCH (n1)-[]->(n2) RETURN n2 $$) AS (n2 agtype);
 n2
----
(0 rows)

psql-15.4-5432-pgsql=#

@ns-hygao
Copy link
Author

@ns-hygao Thank you for pointing out this bug, we will address it. I will point out, though, this particular command is the same as the following, which does work -

psql-15.4-5432-pgsql=# SELECT * FROM cypher('testgraph', $$ MATCH (n1)-[]->(n2) RETURN n2 $$) AS (n2 agtype);
 n2
----
(0 rows)

psql-15.4-5432-pgsql=#

Hi @jrgemignani , Thanks for the response. I realize the 2nd command is equivalent. The original command I tried to run is more complicated and cannot be expressed in one clause. What is reported here is the simplified version after removing all other conditions that do not cause the error.

@jrgemignani
Copy link
Contributor

@ns-hygao Unfortunately, the other PR doesn't quite fix your issue. I am still working on resolving it.

@jrgemignani
Copy link
Contributor

This issue should be fixed in PR #1426 which is now in review.

@rafsun42
Copy link
Member

@ns-hygao Hi, could you let us know if the PR mentioned above solves the issue?

@ns-hygao
Copy link
Author

Hi, the issue has been fixed. Closing out now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants