Re: [BUGS] BUG #14676: neqsel is NULL dumb - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] BUG #14676: neqsel is NULL dumb
Date
Msg-id 4698.1496334173@sss.pgh.pa.us
Whole thread Raw
In response to [BUGS] BUG #14676: neqsel is NULL dumb  (marko@joh.to)
Responses Re: [BUGS] BUG #14676: neqsel is NULL dumb  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-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 likereturn 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

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Next
From: Petr Jelinek
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression