On 08/21/2013 11:02 PM, Igor Tandetnik wrote:
On 8/21/2013 11:17 AM, Simon Slavin wrote:
Given that this level of implementation is correct I feel that any error in SQLite's handling of COLLATE is closer to the expression parsing level than the low level implementation. The low level implementation is fine. The problem would appear to be in

<http://www.sqlite.org/lang_expr.html#collateop>

which states

"The COLLATE operator is a unary postfix operator that assigns a collating sequence to an expression."

This is bad. It says that COLLATE modifies a value. It shouldn't. COLLATE is not a value operator, it's an operator operator. It modifies the '>', not a value one side of it.

I imagine you'd still want to be able to put COLLATE clause on the column definition, as in "create table t (x collate NOCASE);". How is this supposed to work in your hypothetical new world?

Collation is a property of the value, similar to type and affinity - it must be, to allow this kind of annotation. Along with other properties, collation then affects the behavior of operators acting on the value.

ORDER BY and GROUP BY clauses to consider as well. You want to do:

  SELECT ... FROM ... ORDER BY <expr> COLLATE nocase;

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to