SQLite Forum

Weird behavior with xBestIndex and xFindFunction in Virtual table
Login
The xFindFunction function overloading only works in these cases:

  *  *column* `LIKE` *expr*
  *  `LIKE(`*column*,*expr*)

In other words, the syntactic left-hand operand must be a column in
the virtual table in order for function overloading to work.

In the xBestIndex method, the argument column is normally the left-hand
operand, except in the case of the special functions LIKE, GLOB, MATCH,
and REGEXP in which case it is the right-hand operand.

I agree that this is not consistent.  Infix function operators (LIKE, GLOB,
MATCH, and REGEXP) work differently in xFindFunction than they do in
xBestIndex.  But this is apparently the way it has always worked.
Changing it now might break legacy virtual tables.