]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix handling of bare boolean expressions in mcv_get_match_bitmap.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 5 Aug 2022 19:00:03 +0000 (15:00 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 5 Aug 2022 19:00:03 +0000 (15:00 -0400)
commit3fe2fc6bbdb251c78a88cdd41e400014be76f80e
tree03d3ea789dc85a3ccde672ddcf10e7c78e70f1a9
parentea6c916962c4fc87c3d26d938e0149d4c91f2ca0
Fix handling of bare boolean expressions in mcv_get_match_bitmap.

Since v14, the extended stats machinery will try to estimate for
otherwise-unsupported boolean expressions if they match an expression
available from an extended stats object.  mcv.c did not get the memo
about this, and would spit up with "unknown clause type".  Fortunately
the case is easy to handle, since we can expect the expression yields
boolean.

While here, replace some not-terribly-on-point assertions with
simpler runtime tests for lookup failure.  That seems appropriate
so that we get an elog not a crash if we somehow get to the new
it-should-be-a-bool-expression code with a subexpression that
doesn't match any stats column.

Per report from Danny Shemesh.  Thanks to Justin Pryzby for
preliminary investigation.

Discussion: https://postgr.es/m/CAFZC=QqD6=27wQPOW1pbRa98KPyuyn+7cL_Ay_Ck-roZV84vHg@mail.gmail.com
src/backend/statistics/mcv.c
src/test/regress/expected/stats_ext.out
src/test/regress/sql/stats_ext.sql