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
Redis Graph doesn't allow single quote to be escaped when creating a vertex/edge #188
Comments
Hi @tperry, most defiantly, we'll be adding escape character right after we publish our GA mid November, also we should better handle errors from our different clients, in the meanwhile whenever you encounter such an error which isn't verbose enough I'll suggest issuing the faulting query directly to redis using redis-cli to get better error reporting. |
The issue here is a combination of the lexer inside RedisGraph and the way the client/redis-cli escapes strings. Lets' consider following examples:
as we can see, both the values will be converted into double quoted strings. This can also be observed by execution the https://redis.io/commands/monitor command that shows which command the server actually received
Transforming this into cypher statements we get the following output
and this is what Redis received (via monitor command)
The first query can't be interpreted by the current lexer of redisgraph since it can't understand where the value of name starts and ends.
In case of the java client more specifically, we currently recommend option 2 until we have finalised our effort to support the new cypher parser #369 We are still actively investigating a potential enhancement to this issue meanwhile (before we have the full parser support) and will get back on this issue soon |
Here's an example of the problem we've encountered when trying to create a vertex that has a string attribute whose value contains a single quote.
Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: Syntax error at offset 28 near 's'
at redis.clients.jedis.Protocol.processError(Protocol.java:131)
at redis.clients.jedis.Protocol.process(Protocol.java:165)
at redis.clients.jedis.Protocol.read(Protocol.java:219)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:309)
at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:276)
at redis.clients.jedis.Connection.getObjectMultiBulkReply(Connection.java:280)
at com.redislabs.redisgraph.RedisGraphAPI.query(RedisGraphAPI.java:58)
at com.oncam.saas.redisgraph.OrientDbImport.main(OrientDbImport.java:239)
Oct 30, 2018 7:30:26 AM com.orientechnologies.common.log.OLogManager log
INFO: Orient Engine is shutting down...
We also occasionally get a syntax error when trying to create a vertex that contains a String property. I believe the error is caused by the occurrence of a special character in the value of a String property. It would be nice if the list of special characters that need to be escaped was documented and also if the syntax error provided more information about the specific cause of the error.
Thomas Perry
Oncam
The text was updated successfully, but these errors were encountered: