Fan, Allan wrote:
> In 3.6.22,
> 
> CREATE TABLE i1 AS SELECT 0 AS value;
> 
> CREATE TABLE i2(value integer);
> INSERT INTO i2 VALUES(0);
> 
> CREATE TABLE s AS SELECT '0' AS value;
> 
> SELECT typeof (value) FROM i1;
> 
> select (select value from i1) = (select value from s);
> 
> SELECT typeof (value) FROM i2;
> 
> select (select value from i2) = (select value from s);
> 
> 
> I would expect the 2 select statement yield the same value, but one shows 0,
> the other 1. Is this a bug? Thanks.

The first query compares two values with no type affinity, so no type coercion 
takes place. Since they are of different types, they compare not equal.

The second query compares two values of which one has numeric affinity and the 
other no affinity. So SQLite coerces the second value to a number, compares two 
values as numbers and pronounces them equal.

For more details, see http://www.sqlite.org/datatype3.html

Igor Tandetnik

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

Reply via email to