Nesting the usage of a common table in an aggregate means that the columns can be removed inappropriately by projection minimization. A query such as:
with CTE1 as /*+ no_inline */ (SELECT e1, e2, e3 from pm1.g1)
select array_agg((select e3 from cte1 where e1=pm1.g2.e1 and e2=pm1.g2.e2)) from pm1.g2
will return null values for all e3 as projection minimization of CTE1 will replace the column with a null value.
A similar situation occurs when the query above is defined instead in a view. A similar issue was captured on