Amit Langote <amitlangot...@gmail.com> writes: > One thing -- I don't get the division between > CachedPlanAllowsSimpleValidityCheck() and CachedPlanIsSimplyValid(). > Maybe I am missing something, but could there not be just one > function, possibly using whether expr_simple_expr is set or not to > skip or do, resp., the checks that the former does?
Well, we don't want to do the initial checks over again every time; we want the is-valid test to be as simple and fast as we can make it. I suppose we could have one function with a boolean flag saying "this is a recheck", but I don't find that idea to be any better than the way it is. Also, although the existing structure in plpgsql always calls CachedPlanIsSimplyValid immediately after a successful call to CachedPlanAllowsSimpleValidityCheck, I don't think that's necessarily going to be true for other potential users of the functions. So merging the functions would reduce flexibility. regards, tom lane