Is a non-recursive CTE in PostgreSQL guaranteed to be evaluated exactly once and its result reused if referenced multiple times in the outer query?
WITH heavy AS (
SELECT * FROM big_table WHERE expensive_predicate(x)
)
SELECT * FROM heavy a JOIN heavy b ON a.id = b.parent_id;