]> granicus.if.org Git - postgresql/commit
Do ScalarArrayOp estimation correctly when array is a stable expression.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Feb 2014 22:10:49 +0000 (17:10 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Feb 2014 22:10:49 +0000 (17:10 -0500)
commite8655a77f327bd3fca0f4aaf14b86b540c64ecdf
treeba1908a325a4e45b445d5d9f9dc68770b8432fc1
parent5a7e75849cb595943fc605c4532716e9dd69f8a0
Do ScalarArrayOp estimation correctly when array is a stable expression.

Most estimation functions apply estimate_expression_value to see if they
can reduce an expression to a constant; the key difference is that it
allows evaluation of stable as well as immutable functions in hopes of
ending up with a simple Const node.  scalararraysel didn't get the memo
though, and neither did gincost_opexpr/gincost_scalararrayopexpr.  Fix
that, and remove a now-unnecessary estimate_expression_value step in the
subsidiary function scalararraysel_containment.

Per complaint from Alexey Klyukin.  Back-patch to 9.3.  The problem
goes back further, but I'm hesitant to change estimation behavior in
long-stable release branches.
src/backend/utils/adt/array_selfuncs.c
src/backend/utils/adt/selfuncs.c