Move tuplestore relation list from function to estate.

Also change reloid to relid in the Tsr structure, and set it so
that its statistics can be available for planning.

And some minor cosmetic changes in related areas.
Fix a C comment which was copied unchanged from CTE.
Fill in some optimizer routines that are needed for tuplestores.
Fix compile errors from refactoring.
Fix bugs in Tsr allocation and usage.
Fix uninitialized data bugs for transition table fields.

Add an assertion to help catch any others, if any exist.