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