Engine crashes when prepending LIKE wildcard on index

I couldn't find a n1ql project at couchbase.com/issues, so I am posting this here.

Like expressions starting with a wildcard will crash cbq-engine when used on indexed field . My guess is that it's trying to use startKey and endKey on the view, which can only work if the wildcard is at the end of the expression.

cbq> SELECT * FROM gamesim-sample WHERE name LIKE "%a" LIMIT 2
09:37:09.622184 ERROR: Post http://couchbase.devmachine:8093/query: EOF -- main.HandleInteractiveMode() at interactive.go:54

Error output from the engine:

09:33:33.664163 tuqtng started...
09:33:33.664310 version: v0.6.1
09:33:33.664315 site: http://couchbase.devmachine:8091/
panic: runtime error: index out of range
goroutine 195 [running]:
github.com/couchbaselabs/tuqtng/planner/simple.(*ExpressionSargable).computePatternRange(0x210c656c0, 0x210d65481, 0x2, 0x210d65481, 0x2, ...)
// And then a bunch more goroutine messages

1 Answer

« Back to question.


Thanks for letting us know. Bug filed: