>>> Hmm, the grammar has
>>>
>>> CreateAsStmt: CREATE OptTemp TABLE relation_name OptCreateAs AS SubSelect
>>>
>>> and SubSelect doesn't allow unions. This is overly restrictive,
As far as I can tell, it should work to just change the above line in
src/backend/parser/gram.y to
CreateAsStmt: CREATE OptTemp TABLE relation_name OptCreateAs AS SelectStmt
I am doing this in current sources right now. I have not tried it in
REL6_5, but if the problem is getting in your way then give it a try...
regards, tom lane