From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | marko(at)joh(dot)to |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #14676: neqsel is NULL dumb |
Date: | 2017-06-02 21:14:39 |
Message-ID: | 25540.1496438079@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> marko(at)joh(dot)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.
Here's a proposed patch for that. I also fixed patternsel, but elected
not to mess with neqjoinsel; partly because I think joining on inequality
is so rare as to not be worth sweating over, and partly because I wasn't
too sure what's the appropriate correction, especially for semijoins.
Although this is clearly a bug fix, I'm leaning towards committing it
only in HEAD; given the lack of previous field complaints, I fear
back-patching might yield more complaints about destabilizing plans
than kudos for fixing things.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-neqsel-and-patternsel-for-nulls.patch | text/x-diff | 14.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2017-06-02 23:01:21 | [PATCH] Sure you meant response? |
Previous Message | Ray Warren | 2017-06-02 15:39:30 | Re: BUG #14683: *** glibc detected *** SELECT: double free or corruption |