- This topic has 5 replies, 2 voices, and was last updated 11 years, 11 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
Integrated Application Platform
Integrated Application Platform › Forums › General › Bug in query parser?
Hi, I think I have discovered a bug in the Suneido query parsing algorithm.
The following code in the Workspace:
a = 0
a = a - 1 + 1
of course it will generate 0 as output.
Now, if you go in a QueryView and do something like:
create testTable(field1) key(field1)
insert {field1:0} into testTable
testTable extend field2 = field1 - 1 + 1
The output of the query will not be 0, but -2 !!!
Very strange behaviour…
Good one! I can recreate it.
It appears to be treating it as: field1 – (1 + 1)
It works if you do: testTable extend field2 = (field1 – 1) + 1
jSuneido does not appear to have this bug – maybe because it shares the expression parser between the language and the database.
I will get this fixed. Thanks for reporting it!
I found the problem and fixed it.
The parsing code was incorrect and implemented right associativity instead of left. I am surprised we did not find this before now. I guess we do not usually use complicated expressions in queries.
The code for parsing expressions in the language was correct, but I did not keep the two version consistent 🙁
jSuneido does not have this problem because it shares the expression parsing code with both the language and queries.
I will post a new snapshot but if you need the fix right away, let me know.
http://suneido.svn.sourceforge.net/viewvc/suneido/trunk/qparser.cpp?r1=1111&r2=1110&pathrev=1111
Hi Andrew, if you could post a snapshot with the bug fixed it would be very nice. Thanks!
done!