Re: numeric and float comparison oddities - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: numeric and float comparison oddities
Date
Msg-id 1406921960.25839.YahooMailNeo@web122305.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: numeric and float comparison oddities  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: numeric and float comparison oddities
Next
From: Josh Berkus
Date:
Subject: Usability improvements for pg_stop_backup()