Re: [sqlite] Strange comparison with CAST behavior

2013-12-05 Thread Luís Simão
8 Goto 0 2 000 NULL > > -Ursprüngliche Nachricht- > Von: Luís Simão [mailto:l...@portugalmail.com] > Gesendet: Donnerstag, 05. Dezember 2013 12:34 > An: General Discussion of SQLite Database > Betreff: [sqlite] Strange c

Re: [sqlite] Strange comparison with CAST behavior

2013-12-05 Thread Hick Gunter
Goto 0 2 000 NULL -Ursprüngliche Nachricht- Von: Luís Simão [mailto:l...@portugalmail.com] Gesendet: Donnerstag, 05. Dezember 2013 12:34 An: General Discussion of SQLite Database Betreff: [sqlite] Strange comparison with CAST behavior I found th

Re: [sqlite] Strange comparison with CAST behavior

2013-12-05 Thread Clemens Ladisch
Luís Simão wrote: > SELECT 123='123'; // 0 > SELECT CAST(123 AS NUMERIC)='123'; // 1 ??? > > How is this possible? Plain 123 or '123' has affinity NONE. CAST(123 AS NUMERIC) has affinity NUMERIC, so the string gets automatically converted for the comparison. See

[sqlite] Strange comparison with CAST behavior

2013-12-05 Thread Luís Simão
I found this strange behavior in SQLite: While testing whether SQLite performs cast before comparison or just return 0, I entered following: SELECT CAST(123 AS INT)='123'; And for my surprise, it returned 1!!! However, my previous tests checked that numeric/text comparisons always returned