I tested this patch locally and it works for me.
However I doubt if it really improve performance. The original code "contain_volatile_functions((Node *)
rte->values_lists)"recursively work through rte-values_list, and this patch move contain_volatile_functions() into the
forloop, and checks against every item of rte->values_list. As entries of values_list could just be Const,
contain_volatile_functions()will then return immediately, so that this changes reduces total calls to
contain_volatile_functions().From this perspective, this patch may improve the performance.
On the other side, let's say a case where a values_list contains 10 items, and the last item is volatile. With the
originalcode, it won't enter the for loop, nothing will be built; with this patch, operations have been performed on
thefirst 9 items, but eventually it returns NULL when hit the last item. So in this case, performance could be worse.
Overall, I am afraid the burden could beat the gain.
The new status of this patch is: Waiting on Author