data icon indicating copy to clipboard operation
data copied to clipboard

Sqlite does not compare float values correctly

Open mvorisek opened this issue 3 years ago • 0 comments

http://sqlfiddle.com/#!5/9eecb7/14481

SELECT 1.5 > '1';
SELECT 1.5 > '1.2';
SELECT 1.5 > ('1' + 0);
SELECT 1.5 > ('1.2' + 0);
SELECT typeof('1' + 0);
SELECT typeof('1.2' + 0);

PDO does not support binding float type natively, it is always bound as string. And atk4_money type is even always casted to string in php.

Marking as a bug even if Sqlite behaves as documented.

Workaround currently is: a) to put the numeric value into expr. directly like $m->expr('1.2') b) OR cast the bound value using + operator like $m->expr('([] + 0)', [1.2])

mvorisek avatar Jan 05 '22 10:01 mvorisek