Re: [BUGS] numerics lose scale and precision in views of unions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] numerics lose scale and precision in views of unions
Date
Msg-id 9774.1155180948@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] numerics lose scale and precision in views of unions  (Stephen Frost <sfrost@snowman.net>)
Responses Re: [BUGS] numerics lose scale and precision in views of unions
Re: [BUGS] numerics lose scale and precision in views of unions
List pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> Yeah, because numeric_cmp says that 1.0 and 1.00 are equal (what else
>> could it say?  "less" and "greater" are surely wrong).  So you need to

> It could say "not equal" pretty reasonably as the scale is
> different.

Nope, there are exactly three options: equal, less, greater.
btree doesn't understand anything else.

> Unless the SQL spec says differently or we get complaints from people
> I'm all for keeping the current semantics though.

The SQL spec?  Oh, that old thing ... I can't find anything very
specific about it in SQL99, but certainly there is nothing mandating
a different treatment than we are using.  The closest material I can
find is

5.3 <literal>        3) The numeric value of an <exact numeric literal> is determined           by the normal
mathematicalinterpretation of positional decimal           notation.
 

8.2 <comparison predicate>        2) Numbers are compared with respect to their algebraic value.

There's certainly not anything in 8.2 contemplating the idea that two
non-nulls could have any other comparison result than less, equal, or
greater.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: new job
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Win32 max connections bug (causing crashes)