diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-07-15 02:00:31 +0200 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-07-18 11:29:38 +0200 |
commit | e4deae7396f2a5576c0c8289e2bfc005ed3d6989 (patch) | |
tree | ba6b1f879b88b15f0134152be10977ef53d16a5f /src/backend/access/gist/gistutil.c | |
parent | e8b6ae2130e3a95bb776708a9a7c9cb21fe8ac87 (diff) | |
download | postgresql-e4deae7396f2a5576c0c8289e2bfc005ed3d6989.tar.gz |
Fix handling of NULLs in MCV items and constants
There were two issues in how the extended statistics handled NULL values
in opclauses. Firstly, the code was oblivious to the possibility that
Const may be NULL (constisnull=true) in which case the constvalue is
undefined. We need to treat this as a mismatch, and not call the proc.
Secondly, the MCV item itself may contain NULL values too - the code
already did check that, and updated the match bitmap accordingly, but
failed to ensure we won't call the operator procedure anyway. It did
work for AND-clauses, because in that case false in the bitmap stops
evaluation of further clauses. But for OR-clauses ir was not easy to
get incorrect estimates or even trigger a crash.
This fixes both issues by extending the existing check so that it looks
at constisnull too, and making sure it skips calling the procedure.
Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu
Diffstat (limited to 'src/backend/access/gist/gistutil.c')
0 files changed, 0 insertions, 0 deletions