In ExecInitAppend it initialises all the subplans...
for (i = 0; i < nplans; i++){
...
appendstate->as_whichplan = i;
exec_append_initialize_next(node);
..}
And then at the end of the function, it initialises the first plan
again...
appendstate->as_whichplan = 0;
exec_append_initialize_next(node);
return TRUE;
Is this code correct? Should the first plan really be initialised twice?