From: Robert Haas on
Here's a patch to add enable_material, per previous discussion. I
still think we should add enable_joinremoval also, but there wasn't a
clear consensus for that.

I'd appreciate it if someone could check this over for sanity - like,
did I get all the places where materialize nodes can be created? and,
did i prevent them from being inserted anywhere that they are
necessary for correctness?

Thanks,

....Robert