The hook declaration and definition to the same places as the planner_hook is located since the optimizer_hook relates to the part of the planner and I find it good to have the planner related hooks on one place.
The optimizer_hook is called in make_one_rel and the plugin replaces the function 'make_rel_from_joinlist'. I have created a macro standard_optimizer just for better readability of the code in plugins and I did not want to change function names.
I also tried to dig out the dynamic programming optimizer and to compile it and use it as a plugin just to be sure that all the functions necessary to write the optimizer as a plugin are non-static. I placed all the code in joinrels.c, make_one_rel_by_joins and make_rel_from_joinlist functions. Of cause, I renamed all non-static symbols.
Sure, I ran 'make check' without failures.
Is there anything else I should take care? Thanks.