Fixes #6544 adds UNION queries