I opened ticket 3279 because of an unexpected difference in behavior 
between the following selects when col1 is defined as text, but only 
contains integers.  (The first and third return the relevant rows, but 
the middle query returns nothing.)

sqlite> select * from test where col1=1;
sqlite> select * from test where +col1=1;
sqlite> select * from test where col1='1';

This bug was closed because the unary + also has the effect of 
eliminating affinity, thus preventing coercion so an integer != text, 
and thus the code works as designed.  It seems to me, then, that the 
code fails the test of least surprise.  For example, the page 
http://www.sqlite.org/optoverview.html (section 6.0) indicates that the 
unary + is a no-op and only has the effect of preventing the term from 
constraining an index.

It seems to me that either the above webpage should be updated or 
coercion should still occur with the use of the unary +.

Steve Friedman

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

Reply via email to