How can I simplify this UNION?
in ANSI SQL the DISTINCT is totally pointless here. UNION automatically filters duplicates:

test=# SELECT 1 UNION SELECT 1;
 ?column? 
----------
        1
(1 row)


There is a sharp distinction between UNION and UNION ALL:

test=# SELECT 1 UNION ALL SELECT 1;
 ?column? 
----------
        1
        1
(2 rows)


in your case the second subselect can never have the same rows as the first one (due to the empty column) so UNION ALL is already definitely fine here (saving a pointless duplication filter).