On 6/28/17, Jeremy Zeiber <jzei...@gmail.com> wrote:
>
> According to https://sqlite.org/datatype3.html section 4.2, if one
> operator in a comparison is TEXT and the other is INTEGER or no
> affinity, then the TEXT operator is converted to NUMERIC.
>
> Could someone explain the varying results?  What is it really doing?
>

The affinity (TEXT, INTEGER, REAL, NUMERIC, BLOB) is determined by the
declared type of the table column in which the value is stored.  Since
your example as no tables and no columns, all of the affinities are
BLOB.  No automatic conversions occur when comparing two values with
an affinity of BLOB.

Probably this seems very strange to someone who has grown up in the
rigidly-typed world of old-school RDBMSes and programming languages
taught at many universites. The conversion rules of SQLite may seem
strange, but they are designed so that the same code that works on
PostgreSQL will also work in the same way in SQLite, while still
allowing flexible typing.

If you just ignore all the rules, things generally work out the way
you want.  Most people never have to think about it - they just get
the answer they were expecting.

What unusual thing are you doing that requires you to become an expert
on the arcane type-conversion rules of SQLite?

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to