(PDB-1076) Make environment garbage collection ignore null values

If a factset, report or catalog is migrated from an earlier puppetdb
version or submitted with a earlier puppetdb-terminus version it has
NULL as environment_id. If any of them have a record with that PuppetDB
failed to garbage collect any environments at all as the subselect
returned a NULL value.

Switching from UNION ALL to just UNION speeds up the query dramatically
as the return value from the subselect is much smaller (doesn't contain
any duplicates).