From: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: numeric and float comparison oddities |
Date: | 2014-08-01 19:39:20 |
Message-ID: | 1406921960.25839.YahooMailNeo@web122305.mail.ne1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Kevin Grittner <kgrittn(at)ymail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2014-08-01 22:45:57 | Usability improvements for pg_stop_backup() |
Previous Message | Tom Lane | 2014-08-01 19:27:10 | Re: numeric and float comparison oddities |