I've started to look at this now. First comment, is that the patch doesn't have consistent formatting(mixed space/tab lines, for one). Second, the test case should test unions across different tables, with differently named columns, but with the same type. Plus, we now support conditions in views, which this patch doesn't support at all.
This kind of large change is not something that should be in a single patch. It should be broken up into much smaller chunks. One I see that could be done right off the bat is the refactoring in SqlJdbcUtil to move the view sql generation into a separate method.
I see it only supports UNION and UNION ALL. Why not INTERSECT and EXCEPT variants as well?
Why don't theta-oracle and theta-mssql support unions? If it's because of the different way conditions are done, then that's not correct. Just create nested tables.
I'm willing to take the code inside this patch, and use it as a starting point, for something better, so I'm not asking for your help on any of the restructuring. But I may still have questions about it from time to time. I also can't give a concrete timeframe as to when it will be done. I could make use of this tho in one of our own projects.
Do you have any thoughts about how to do dynamic views with unions?