Join GitHub today
SQLite + upper() or lower() does not work as expected #151
Since SQLite does not support Unicode operations,
http://www.sqlite.org/faq.html#q18 case (18) about collation and sorting (!)
So, my decision is:
Next. Suppose we want to
Also, we should discover if SQL index by string field will be (1) correct and (2) effective if custom collation will be used.
Now Pony registers two additional unicode-aware functions in SQLite:
>>> select(p.id for p in Person if p.name.upper() == 'John')[:]
SELECT "p"."id" FROM "Person" "p" WHERE py_upper("p"."name") = 'John'
For other databases Pony still uses standard
If you want to sort query by a column in a case-insensitive way, you can manually call
>>> select(p.id for p in Person).order_by(lambda: p.name.upper())[:]
SELECT "p"."id" FROM "Person" "p" ORDER BY py_upper("p"."name")
added a commit
Jan 15, 2016