Re: numeric and float comparison oddities

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: numeric and float comparison oddities
Дата
Msg-id 1406921960.25839.YahooMailNeo@web122305.mail.ne1.yahoo.com
обсуждение исходный текст
Ответ на Re: numeric and float comparison oddities  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Kevin Grittner <kgrittn@ymail.com> writes:
>> It would be more consistent, ISTM, to cast
>> float8 to float4 when those are compared, and to cast numeric to
>> whichever type is on the other side of the comparison operator.
>
> I would vote against that on the grounds of greatly increased risk
> of overflow failure.  Admittedly, numeric->float8 can also fail,
> but float4 only goes to 1e37 or thereabouts.

Since 1e28 is sufficient to measure the diameter of the universe in
angstroms, I'm not sure I accept the adjective "greatly" there.  I
suspect that people are getting silently burned by current behavior
more often than they would get overflow errors with the change.  At
least when you get an error it's pretty clear how to fix it with a
cast.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: numeric and float comparison oddities
Следующее
От: Josh Berkus
Дата:
Сообщение: Usability improvements for pg_stop_backup()