Re: numeric hierarchy again (was Re: floor function in 7.3b2)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Mario Weilguni <mario(dot)weilguni(at)icomedias(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: numeric hierarchy again (was Re: floor function in 7.3b2)
Date: 2002-10-04 16:01:54
Message-ID: 200210041601.g94G1sX08727@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Moving to the left requires an explicit cast (or at least an assignment
> to a column). I know this looks strange to someone who knows that our
> numeric type beats float4/float8 on both range and precision, but it's
> effectively mandated by the SQL spec. Any combination of "exact" and
> "inexact" numeric types is supposed to yield an "inexact" result per
> spec, thus numeric + float8 yields float8 not numeric. Another reason
> for doing it this way is that a numeric literal like "123.456" can be
> initially typed as numeric, and later implicitly promoted to float4 or
> float8 if context demands it. Doing that the other way 'round would
> introduce problems with precision loss. We had speculated about
> introducing an "unknown_numeric" pseudo-type to avoid that problem, but
> the above hierarchy eliminates the need for "unknown_numeric". We can
> initially type a literal as the smallest thing it will fit in, and then
> do implicit promotion as needed. (7.3 is not all the way there on that
> plan, but 7.4 will be.)

Do we know that defaulting floating constants will not be a performance
hit?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message scott.marlowe 2002-10-04 16:05:10 Re: [HACKERS] Large databases, performance
Previous Message Manfred Koizar 2002-10-04 16:00:53 Re: Return of INSTEAD rules