Re: [BUGS] numerics lose scale and precision in views of unions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: "Brian C(dot) DeRocher" <brian(dot)derocher(at)mitretek(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] numerics lose scale and precision in views of unions
Date: 2006-08-10 03:35:48
Message-ID: 9774.1155180948@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)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 mathematical interpretation 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew - Supernews 2006-08-10 03:40:11 Re: [BUGS] numerics lose scale and precision in views of unions
Previous Message Stephen Frost 2006-08-10 02:22:15 Re: [BUGS] numerics lose scale and precision in views of unions

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2006-08-10 03:38:32 Re: Win32 max connections bug (causing crashes)
Previous Message Marc G. Fournier 2006-08-10 03:16:40 Re: new job