orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Console: SQL Errors / Regressions

Open dxxr opened this issue 12 years ago • 1 comments

OrientDB v1.7.3 These commands worked in 1.7-rc2 .. so I guess there are regressions

Add a document to an embedded list property

UPDATE Foo ADD list = {"@type":"d", "@class":"Bar",  "value":1.23} WHERE key = 'foo1';

Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.select from Foo WHERE  key = 'foo1'

Error: com.orientechnologies.orient.core.exception.OValidationException: The field 'Foo.list' has been declared as EMBEDDEDLIST but the value is the RecordID #-1:-1

Escaping quotes for the format() function

UPDATE Foo SET test = format('aaa \' bbb') WHERE key = 'foo1';
[Does nothing, no info or error message]

UPDATE Foo SET test = format('aaa \' bbb', '') WHERE key = 'foo1';
[Does nothing, no info or error message]

UPDATE Foo SET test = 'aaa \' bbb', test2 = format('aaa \' bbb') WHERE key = 'foo1';
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Syntax error: function 'format' needs 2--1 argument(s) while has been received 1

UPDATE Foo SET test = 'aaa \' bbb', test2 = format('aaa \' bbb', '') WHERE key = 'foo1';
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Syntax error: function 'format' needs 2--1 argument(s) while has been received 1

The format() function is documented to only require the first format string argument, and even when supplied a second argument an error is reported. This does only seems to occur in combination with the escaped quote in the first assignment.

Additionally, escaping in general should be better documented: How do I set a string property to a value containing special characters like line breaks, tabs or the already mentioned quotes?

UPDATE Foo SET test = 'aaa \n bbb'
Updated record(s) '1' in 0,002000 sec(s).
[simply omits the backslash, although I seem to remember it working somewhere around v1.5.x]

UPDATE Foo SET test= 'aaa \' bbb'
[Does nothing, no info or error message]

dxxr avatar Jun 13 '14 22:06 dxxr

The escaping issues might be connected to #2424

dxxr avatar Jun 13 '14 22:06 dxxr