From: Tom Lane <tgl@sss.pgh.pa.us>
To: marko@joh.to
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14676: neqsel is NULL dumb
Date: Thu, 01 Jun 2017 12:22:53 -0400
Message-ID: <4698.1496334173@sss.pgh.pa.us> (raw)
In-Reply-To: <20170529153847.4275.95416@wrigleys.postgresql.org>
References: <20170529153847.4275.95416@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
marko@joh.to writes:
> This seems to be because neqsel() doesn't take at all into account that both
> operators will exclude NULL rows, and does a simple 1.0 - eqsel().
Yeah, that's clearly broken. A localized fix would be to re-fetch the
nullfrac statistic and subtract it off, but that seems pretty inefficient.
I'd be inclined to refactor things so that eqsel() and neqsel() call a
common routine that takes a "bool negate" argument, about like the way the
patternsel() functions work, and then the common routine could handle
the nullfrac correctly for both cases.
Hmm ... actually, I think patternsel() is broken for this case too ---
it has the information to do the right thing, but it doesn't look like
it actually is doing it:
return negate ? (1.0 - result) : result;
should be more like
return negate ? (1.0 - result - nullfrac) : result;
neqjoinsel has a similar issue, and I'm not sure what else.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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, marko@joh.to
Subject: Re: BUG #14676: neqsel is NULL dumb
In-Reply-To: <4698.1496334173@sss.pgh.pa.us>
References: <20170529153847.4275.95416@wrigleys.postgresql.org> <4698.1496334173@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