neo4j-graphql-java icon indicating copy to clipboard operation
neo4j-graphql-java copied to clipboard

Variables used multiple times breaks Cypher generation (duplicate statement parameters)

Open yarc opened this issue 3 years ago • 1 comments

I'm currently running version 1.2.0 and i encountered this issue while upgrading to 1.4.0:

I have a query that declares a new argument/variable and references this argument in 4 places in the query. This results in the query crashing with this error message. If instead i keep only 1 reference of the variable the query works.

Parameter 'authUser' is defined multiple times with different bound values: VariableReference{name='authUser'} != VariableReference{name='authUser'} != VariableReference{name='authUser'} != VariableReference{name='authUser'} != VariableReference{name='authUser'}

And stack trace

org.neo4j.cypherdsl.core.ConflictingParametersException: Parameter 'authUser' is defined multiple times with different bound values: VariableReference{name='authUser'} != VariableReference{name='authUser'} != VariableReference{name='authUser'} != VariableReference{name='authUser'} != VariableReference{name='authUser'} at org.neo4j.cypherdsl.core.ParameterCollectingVisitor.getResult(ParameterCollectingVisitor.java:94) ~[neo4j-cypher-dsl-2021.0.2.jar:2021.0.2] at org.neo4j.cypherdsl.core.AbstractStatement.collectParameters(AbstractStatement.java:103) ~[neo4j-cypher-dsl-2021.0.2.jar:2021.0.2] at org.neo4j.cypherdsl.core.AbstractStatement.getParameterInformation(AbstractStatement.java:84) ~[neo4j-cypher-dsl-2021.0.2.jar:2021.0.2] at org.neo4j.cypherdsl.core.AbstractStatement.getParameters(AbstractStatement.java:53) ~[neo4j-cypher-dsl-2021.0.2.jar:2021.0.2] at org.neo4j.graphql.handler.BaseDataFetcher.get(BaseDataFetcher.kt:38) ~[neo4j-graphql-java-1.4.0.jar:na] at org.neo4j.graphql.handler.BaseDataFetcher.get(BaseDataFetcher.kt:20) ~[neo4j-graphql-java-1.4.0.jar:na]

yarc avatar Nov 16 '21 18:11 yarc

@yarc Can you please test with the current master to see if the problem persists? If so can you provide a testcase.

Andy2003 avatar Nov 16 '21 23:11 Andy2003