pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: knz@thaumogen.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15297: Irregular comparison rules for NULLs in tuples
Date: Thu, 26 Jul 2018 10:03:56 -0400
Message-ID: <27390.1532613836@sss.pgh.pa.us> (raw)
In-Reply-To: <153261212701.1395.18260320763646237974@wrigleys.postgresql.org>
References: <153261212701.1395.18260320763646237974@wrigleys.postgresql.org>

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> The SQL standard mandates ternary logic for values that involve NULL, where
> NULL means "unknown".

Right.

> "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.  The same goes
for elements in other container types such as arrays.

I don't know whether this behavior can be justified by chapter and verse
in the SQL standard, but it doesn't really matter; we will not change it.

			regards, tom lane




view thread (4+ messages)  latest in thread

Message-ID: <27390.1532613836@sss.pgh.pa.us>
Permalink:  ../27390.1532613836@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27390.1532613836@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, knz@thaumogen.net
  Subject: Re: BUG #15297: Irregular comparison rules for NULLs in tuples
  In-Reply-To: <27390.1532613836@sss.pgh.pa.us>
  References: <153261212701.1395.18260320763646237974@wrigleys.postgresql.org> <27390.1532613836@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox