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

SQL Command throws Error in cypher.sql #321

Open
skkk98 opened this issue Oct 10, 2022 · 5 comments
Open

SQL Command throws Error in cypher.sql #321

skkk98 opened this issue Oct 10, 2022 · 5 comments
Labels
question Further information is requested

Comments

@skkk98
Copy link

skkk98 commented Oct 10, 2022

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.

@skkk98 skkk98 added the question Further information is requested label Oct 10, 2022
@JoshInnis
Copy link
Contributor

Yes those regression tests are confirming that the second argument of the Cypher function cannot be NULL and cannot be a single-quoted string.

@jrgemignani
Copy link
Contributor

If this has been resolved, please make sure to close the issue :)

@skkk98 skkk98 closed this as completed Oct 18, 2022
@jrgemignani jrgemignani reopened this Oct 18, 2022
@jrgemignani
Copy link
Contributor

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.

@shinyaaa
Copy link
Contributor

shinyaaa commented Aug 9, 2024

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

@jrgemignani
Copy link
Contributor

@shinyaaa This isn't necessarily true anymore. The function can be called, in special cases, cypher(null, null).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants