> The behavior of cast(XX as YY) is not the same as the old version, such
> as 3.3.4, and also different to SQL Server or MYSQL.
Don't complain that SQLite's cast works the other way than SQL Server
or MySQL. SQLite behaves in a very unique way when the type-related
matters are a concern. And you better tell as how behavior of cast()
is different from 3.3.4.
But this behavior is definitely a bug:
sqlite> create table t(f1);
sqlite> insert into t values('1');
sqlite> select f1, typeof(f1) from t;
1|text
sqlite> select * from t where cast(f1 as int) = 1;
1
sqlite> select * from t where f1 = '1';
1
sqlite> select * from t where f1 = 1;
sqlite> select * from t where f1 = '1' and cast(f1 as int) = 1;
1
sqlite> select * from t where cast(f1 as int) = 1 and f1 = '1';
sqlite> -- query above should return a row
Pavel
On Thu, Dec 24, 2009 at 6:15 AM, zhangzhenggui <[email protected]> wrote:
> Dear Friend,
>
> My sqlite version is 3.6.21. I find that, the behavior of cast(XX as YY)
> is not the same as other DBMS, such as SQL Server, MYSQL.
>
> This is my test:
> create table t(f1);
> insert into t values('1');
>
> select * from t where cast(f1 as int) = 1 and f1 = '1';
> select * from t where f1 = '1' and cast(f1 as int) = 1;
>
> The results of ths two 'select' are different. The first 'select' gets
> nothing and the second 'select' gets one record.
> The value of f1 is changed to int type after call cast(f1 as int).
> The behavior of cast(XX as YY) is not the same as the old version, such
> as 3.3.4, and also different to SQL Server or MYSQL.
>
> Is this a bug? or a characteristic of sqlite?
>
> I hope for your response, thanks.
> Thanks a again.
>
>
> Thanks
> zhangzhenggui
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users