I wrote:
> I agree with that sounding more principled, but I wonder if we should
> think bigger than just tweaking add_nullingrels_if_needed: if we're
> desirous of de-duplicating PHVs, why not do that across the board,
> for every place that makes PHVs? So we'd mechanize this in
> make_placeholder_expr's assignment of phid rather than somewhere else.
Actually, we can't be too gung-ho about that: we should not merge
PHVs if their expressions are volatile. It's not quite clear to me
whether that's a problem for the join-alias-Vars case.
regards, tom lane