Re: Bug #627:
От | Tom Lane |
---|---|
Тема | Re: Bug #627: |
Дата | |
Msg-id | 890.1017413564@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Bug #627: (pgsql-bugs@postgresql.org) |
Список | pgsql-bugs |
pgsql-bugs@postgresql.org writes: > create table t1 (f1 real); > insert into t1 values(1.01); > select * from t1 where f1 > 1.01; regression=# create table t1 (f1 real); CREATE regression=# insert into t1 values(1.01); INSERT 139787 1 regression=# select * from t1 where f1 > 1.01; f1 ---- (0 rows) And your point was? BTW, if you were going to complain that on your platform the SELECT returns the row, don't bother. Float comparisons are inherently inaccurate. You might, however, find that the behavior is less surprising if you do the comparison against a float4 (== real) rather than float8 constant: select * from t1 where f1 > '1.01'::real; The query as you wrote it will convert the original 1.01 to float4 for storage and then to float8 for comparison against the second 1.01 (which never becomes float4), so a little bit of roundoff error is likely to creep in. regards, tom lane
В списке pgsql-bugs по дате отправления: