pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: ganeshmmahesh@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17068: Incorrect ordering of a particular row.
Date: Tue, 22 Jun 2021 10:00:22 -0400
Message-ID: <1714546.1624370422@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvoKk=NO7H6p8UNjSXbio8vq9yUjZhHO_Xr=C14WMs9i+A@mail.gmail.com>
References: <17068-18d0626f1d26394d@postgresql.org>
	<CAApHDvr=A5ZMYm-Jy1g4AyfMBeOJGfP_5zJEW9N9k_S5PjwN4Q@mail.gmail.com>
	<CA+hUKG+TrnLnccaspLsimQnm34wUsdxSpxQiS9jrTScUo=kFiQ@mail.gmail.com>
	<CAApHDvoKk=NO7H6p8UNjSXbio8vq9yUjZhHO_Xr=C14WMs9i+A@mail.gmail.com>

David Rowley <dgrowleyml@gmail.com> writes:
> On Wed, 23 Jun 2021 at 01:26, Thomas Munro <thomas.munro@gmail.com> wrote:
>> If you change the SELECT list to output alias3::text, there's a
>> different value there:

> Yeah, if I change it to ORDER BY alias3.lastname, nullnamesb.id;
> instead of ORDER BY alias3.*, nullnamesb.id; then the tie break using
> btint4fastcmp() is called more often.  It's also getting called with
> the missing 4s which I mentioned upthread.
> See the two outputs.  That points me towards something weird going on
> in record_cmp().

I believe Munro's point is that in some rows alias3.* is a NULL composite
value, while in other rows it is a composite containing one NULL, and they
don't sort the same.  Presumably the former are from left-join extension
while the latter come from actual table rows having NULL in that column.

(I'd suspected something of the kind, but being caffeine-deprived I'd
first added "alias3.* IS NULL" to the query, which of course fails to
expose the difference.  Thanks SQL.)

In short, I see no bug here.  It is kind of obscure though.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <1714546.1624370422@sss.pgh.pa.us>
Permalink:  ../1714546.1624370422@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1714546.1624370422@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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, thomas.munro@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17068: Incorrect ordering of a particular row.
  In-Reply-To: <1714546.1624370422@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