Re: BUG #15297: Irregular comparison rules for NULLs in tuples

From: Raphael 'kena' Poss <knz(at)thaumogen(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15297: Irregular comparison rules for NULLs in tuples
Date: 2018-07-26 14:08:54
Message-ID: 94ffed23-67eb-3eac-e08e-5d4bf5287d8d@thaumogen.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Op 26-07-18 om 10:03 schreef Tom Lane:
>> "select (1, (1, NULL::int)) > (1, (1, 2))" -> returns true !?
>
> We insist on non-null record values being totally ordered, because without
> that you can't build a working btree opclass for them. So the general
> principle for comparing corresponding fields in two records is that nulls
> sort after non-nulls and two nulls are treated as equal.

I'd really like this to be true (I like it, it's simple) but then how do
you explain that row(1, null) > row(1, 2) is NULL, and not true? both
sides are record values and they are not null, after all.

--
Raphael 'kena' Poss

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-07-26 14:50:42 Re: BUG #15297: Irregular comparison rules for NULLs in tuples
Previous Message Tom Lane 2018-07-26 14:03:56 Re: BUG #15297: Irregular comparison rules for NULLs in tuples