Richard Guo <guofenglinux@gmail.com> writes: > Update with v3 patch, nothing changes except fixes a test failure > spotted by cfbot.
I think this is pretty close to usable, except that I don't believe reusing simplify_boolean_equality this way is a great idea. It does more than we need (surely the LHS-is-Const case cannot occur here) and it has assumptions that I'm not sure hold --- particularly the bit about !constisnull. I'd be inclined to just copy-and-paste the three or four lines we need.
Thanks for the suggestion. Yes, simplify_boolean_equality is doing more than we need. I think here we just intend to handle indexquals of form "indexkey = true/false", which seems can only come out from function match_boolean_index_clause. From what this function does, we are sure the constant input can be only on right (as you pointed out), and the operator can only be BooleanEqualOperator. Also it seems the assumption about !constisnull holds, as match_boolean_index_clause would not make a clause with a constant-NULL input.
I've updated the patch according to the suggestions as in v4. Thanks for reviewing this patch!