Include non-inserted rows as result of INSERT INTO ... RETURNING
I would simply separate the query logic and the insert logic: 

with vals (a,b) as (
  VALUES (1, null), (null, 2), (2, 3)
), new_rows as (
  insert into all_sums (sum)
  select a + b
  from vals
  where a + b is not null
)
select a + b
from vals;


Online example