Skip to content

Filter NOT EXISTS leads to an error if a relation label does not exists as database table #1399

Closed

Description

@nupis-DanielS

Describe the bug
We run in an error if we query for a non existing relationship. If the filter contains the label of the relationship it will return "Variable foo does not exist". When the relationship label is not used everything works as expected. It looks like that the error occurs only when the database table for the label is not present..

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

  • JDBC
  • pg (Node)

What data setup do we need to do?

/

What is the necessary configuration info needed?

  • /

What is the command that caused the error?

SELECT * FROM cypher('property-graph', $$ 
  MATCH (foo)
  WHERE NOT exists((foo)-[:BAR]->())
  RETURN count(foo) > 0
$$) as (c agtype)
Variable `foo` does not exist

Expected behavior
false

Environment (please complete the following information):

  • Version: 1.4.0
  • PostgreSQL: 14.6 (Ubuntu 14.6-1.pgdg22.04+1)

Additional context
Without non existing relation label it works as expected (result -> false).

Activity

  1. added
    bug
    on Nov 15, 2023
  2. jimenasansav commented on Nov 15, 2023

    @jimenasansav

    Hi @nupis-DanielS! Thank you for letting us know about this issue. Our technical team will go through it and provide a solution soon. In the meantime, please feel free to reach out if you have any other questions.

  3. jrgemignani commented on Nov 15, 2023

    @jrgemignani
    Contributor

    @nupis-DanielS I will look into this. Related to #1393

    psql-15.4-5432-pgsql=# SELECT * FROM cypher('property-graph', $$ MATCH (foo) WHERE NOT exists((foo)-[:BAR]->()) RETURN count(foo) > 0 $$) as (c agtype)
    ;
    ERROR:  variable `foo` does not exist
    LINE 1: ...property-graph', $$ MATCH (foo) WHERE NOT exists((foo)-[:BAR...
                                                                 ^
    psql-15.4-5432-pgsql=# SELECT * FROM cypher('property-graph', $$ create ()-[:BAR]->() $$) as (c agtype)                             ;
     c
    ---
    (0 rows)
    
    psql-15.4-5432-pgsql=# SELECT * FROM cypher('property-graph', $$ MATCH (foo) WHERE NOT exists((foo)-[:BAR]->()) RETURN count(foo) > 0 $$) as (c agtype)
    ;
      c
    ------
     true
    (1 row)
    
    psql-15.4-5432-pgsql=#
    
  4. added a commit that references this issue on Nov 16, 2023
  5. jrgemignani commented on Nov 16, 2023

    @jrgemignani
    Contributor

    @nupis-DanielS PR #1400 should resolve this once reviewed and merged.

  6. added a commit that references this issue on Nov 16, 2023
  7. added a commit that references this issue on Nov 16, 2023
  8. jrgemignani commented on Nov 16, 2023

    @jrgemignani
    Contributor

    @nupis-DanielS The fix is now in the master branch. If you could verify that it satisfactorily resolves your issue and close it, that would be great.

  9. added 4 commits that reference this issue on Nov 17, 2023
  10. added a commit that references this issue on Nov 17, 2023
  11. nupis-DanielS commented on Nov 17, 2023

    @nupis-DanielS
    Author

    @nupis-DanielS The fix is now in the master branch. If you could verify that it satisfactorily resolves your issue and close it, that would be great.

    Hi @jrgemignani . We would love to test this but we use the "PG14" Branch. I think we will create a separate PG14 branch and cherry pick your commit. We close this issue if everything works as expected.

    Thank you

  12. added 3 commits that reference this issue on Nov 17, 2023
  13. MuhammadTahaNaveed commented on Nov 17, 2023

    @MuhammadTahaNaveed
    Member

    Hi @jrgemignani . We would love to test this but we use the "PG14" Branch. I think we will create a separate PG14 branch and cherry pick your commit. We close this issue if everything works as expected.

    Thank you

    @nupis-DanielS The fix is now on PG14 branch as well. It would be great if you could check it out.

  14. added a commit that references this issue on Nov 17, 2023
  15. nupis-DanielS commented on Nov 17, 2023

    @nupis-DanielS
    Author

    Hello again @jrgemignani. Your fix works. The query returns successful even if the relationship label does not exist in the database. Thank you

  16. added a commit that references this issue on Dec 13, 2023
  17. added a commit that references this issue on Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions