SQL Command throws Error in cypher.sql
I came across some commands that throw errors in cypher.sql and I am not sure whether this is expected behavior or not.
I am unsure whether this is okay because the expected and actual results throw log these errors when running this command.
SELECT * FROM cypher('cypher', 'RETURN 0') AS r(c text);
ERROR: a dollar-quoted string constant is expected
LINE 1: SELECT * FROM cypher('cypher', 'RETURN 0') AS r(c text);
SELECT * FROM cypher('cypher', NULL) AS r(c text);
ERROR: a dollar-quoted string constant is expected
LINE 1: SELECT * FROM cypher('cypher', NULL) AS r(c text);
Are these test cases valid? Or should it be changed? like SELECT * FROM cypher('cypher', $$RETURN 0$$) AS r(c text);
Also if these test cases are valid then is okay to add a test case like SELECT * FROM cypher('cypher', ##RETURN 0##) AS r(c text); since this will throw an error as well.
Yes those regression tests are confirming that the second argument of the Cypher function cannot be NULL and cannot be a single-quoted string.
If this has been resolved, please make sure to close the issue :)
Sorry, I should have noted the following before suggesting closing the issue -
If those regression tests are supposed to throw errors and there isn't a comment stating that, I think that a comment should be added for clarity.
The following comments are written before those tests, so I think no additional comments will be necessary.
-- cypher() function takes only a dollar-quoted string constant as an argument.
-- All other cases throw an error.
https://github.com/apache/age/blob/master/regress/sql/cypher.sql#L25-L26
@shinyaaa This isn't necessarily true anymore. The function can be called, in special cases, cypher(null, null).