Seems to me the SQL standard makes no distinction between columns and literals does it? Why should literals be ignored?
Oracle gives the right answer too for example(contrary to what somebody said earlier). create table numtypes (A NUMERIC, B NUMERIC, C NUMERIC); insert into numtypes values (1, 2, 25.23); insert into numtypes values (1.0, 2, 27.17); insert into numtypes values (1.1, 2, 22.92); select A/B*C from numtypes; A/B*C ---------- 12.5 13.5 11.5 SQL> desc numtypes; Name Null? Type ----------------------------------------- -------- ---------------------------- A NUMBER(38) B NUMBER(38) C NUMBER(38) -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Sunday, May 12, 2013 6:29 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Possible bug in type conversion prior to comparison On Sun, May 12, 2013 at 7:55 AM, Tomasz Pawlak < tomasz.paw...@cs.put.poznan.pl> wrote: > > So, type of '1' is 'text'. > > * If one operand has INTEGER, REAL or NUMERIC affinity and the other > operand as TEXT or NONE affinity then NUMERIC affinity is applied to other > operand. " > > So, if we compare 1 with '1' (e.g. 1='1'), '1' should be converted to > numeric, right? > No. '1' has type 'text' but it has no affinity at all. Likewise 1 has type 'integer' but no affinity. So no conversions take place, and the answer is FALSE. Affinity is only associated with table columns. Literals never have affinity. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users