Hello!

On Monday 01 March 2010 08:05:06 Darren Duncan wrote:
> Alexey Pechnikov wrote:
> > Hello!
> > 
> > On Thursday 25 February 2010 02:53:32 Igor Tandetnik wrote:
> >> http://www.sqlite.org/datatype3.html
> >> For conversions between TEXT and REAL storage classes, SQLite considers 
> >> the conversion to be lossless and reversible if the first 15 significant 
> >> decimal digits of the number are preserved.
> > 
> > The SQLite datatyping is very different from other RDBMS:
> > 
> > sqlite> select 1='1';
> > 0
> > 
> > Postgres:
> > template1=# select 1='1';
> >  ?column? 
> > ----------
> >  t
> > 
> > And there are a lot of problem as result, see some tests here:
> > http://sqlite.mobigroup.ru/src/wiki?name=tclsqlite
> > 
> > I don't know how to fix it in the SQLite core. My patch for 
> > the tclslite interface can't resolve the internal problem...
> 
> It would seem to me that asking [1='1'] *should* return false because the 
> numeric and character string value domains are logically disjoint, so no 
> value 
> from one could ever equal a value from another, and so SQLite's answer is 
> correct.

See http://sqlite.org/datatypes.html:
"If both inputs look like well-formed numbers, then they are converted into 
floating point values using atof() and compared numerically."

And so 1 may be equal to 1.

> As for your Postgres, what version of Postgres are you using?  

template1=# select version();
                                                    version                     
                                
----------------------------------------------------------------------------------------------------------------
 PostgreSQL 8.1.15 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.1.2 
20061115 (prerelease) (Debian 4.1.1-21)


> AFAIK, since at 
> least Postgres 8.3, Postgres became stricter and stopped doing implicit 
> casting 
> between disjoint data types, which would be required for [1='1'] to be true.

It's a registered bug in 8.3.0 release.

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to