It's getting confused and thinks you're attempting to write a recursive statment.
Try using the TABLE keyword...
Code:
select cols
from table (
select cols
from table1
union all
select cols
from table2
) tmpTable
;
Also, think about using UNION ALL in preference to UNION unless there is a good reason to distinct your select.