SQLite Forum

How to avoid 'row X missing from index' when using a custom collation?
Login
> My first solution was to use a custom function, eg. transliterate_to_ascii:
 > 
 > SELECT * FROM names WHERE transliterate_to_ascii(name) LIKE transliterate_to_ascii('%médéric%') ORDER BY transliterate_to_ascii(name);
 > 
 > But obviously this doesn't scale very well as that function would be called a lot, as I can't use indexes.

Well, actually you can.  You can create an index on the function:

```
create index i0 on names(transliterate_to_ascii(name));
```

SQLite3 libraries compiled with SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1 will be able to open and read the database.  However, they will not be allowed to update it because that requires that the unknown SQL function be actually present.