activegraph icon indicating copy to clipboard operation
activegraph copied to clipboard

Silent failure of where/where_not on QueryProxy with bad arguments

Open yourpalal opened this issue 5 years ago • 0 comments

In some cases, a where or where_not clause is silently ignored when it should probably throw an error.

Code example

Assume you have a model class called ExampleNode.

ExampleNode.all(:c).where(:uuid, list_of_ids).to_cypher == "MATCH(c:`ExampleNode`)"
ExampleNode.all(:c).where_not(:uuid, list_of_ids).to_cypher == "MATCH(c:`ExampleNode`)"

The input (which in my case was supposed to be where_not(uuid: list_of_ids)) is silently ignored.

Expected result

An error should be thrown (this input doesn't make any sense anyway!).

Not a neo4j-core issue

irb(main):011:0> Neo4j::ActiveBase.new_query.match(:c).where_not(:uuid, [3]).to_cypher
ArgumentError: Invalid argument for WHERE.  Full arguments: :uuid

A non-proxy query correctly raises an error.

Runtime information:

Neo4j database version: neo4j gem version: 8.1.5 neo4j-core gem version: custom fork with 1 tiny, unrelated change based on b96740c51514043146281a85279925abd6b49a30

yourpalal avatar Jul 17 '18 19:07 yourpalal