I wrote:
>> The implication of doing it like this would be that the default estimate
>> in the absence of any matching stats would be 0.5 (since eqsel defaults
>> to 1/ndistinct, and get_variable_numdistinct will report 2.0 for any
>> boolean-type expression it has no stats for). That's not a huge change
>> from the existing 0.3333333 estimate, which seems pretty unprincipled
>> anyway ... but it would probably be enough to annoy people if we did it in
>> stable branches. So I'd be inclined to propose changing this in HEAD and
>> maybe 9.5, but not further back. (For non-function expressions, 0.5 is
>> the default already, so those would not change behavior.)
> I experimented with the attached patch. The change in the default
> estimate for a function results in just one change in the standard
> regression test results, so far as I can find.
After more thought I concluded that changing the default behavior is
something not to do without a lot more testing than I have time for now.
So I modified the patch to preserve the old default estimate for
statistics-less function calls, and pushed it.
regards, tom lane