]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix booltestsel() for case where we have NULL stats but not MCV stats.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Jul 2013 04:44:09 +0000 (00:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Jul 2013 04:44:59 +0000 (00:44 -0400)
commit8e992b01864198af954111ffee9b05635c0ae4c0
treeaaf50d5142f960b654cf1b45ef01a20bf0e7a771
parentf6a6d204fd33f89f3f472790b58a9992bce1358e
Fix booltestsel() for case where we have NULL stats but not MCV stats.

In a boolean column that contains mostly nulls, ANALYZE might not find
enough non-null values to populate the most-common-values stats,
but it would still create a pg_statistic entry with stanullfrac set.
The logic in booltestsel() for this situation did the wrong thing for
"col IS NOT TRUE" and "col IS NOT FALSE" tests, forgetting that null
values would satisfy these tests (so that the true selectivity would
be close to one, not close to zero).  Per bug #8274.

Fix by Andrew Gierth, some comment-smithing by me.
src/backend/utils/adt/selfuncs.c