Tom Lane wrote:
>
> Jan Wieck <wieck@debis.com> writes:
>
> > These two examples will result in exactly the same querytree after
> > rewriting, if you SELECT from v1. The second needs two passes in the
> > rewriter, but that's the only difference.
>
> Actually, there's another big difference: the stored rule plan string
> for v1 in the second case is shorter than it is in the first case,
> because the a+b additions don't show up as operator nodes in v1's
> definition in the second case. (If the references to v1_sub were
> flattened out before the rule were stored, it wouldn't take two passes
> of rewriting to expand the rule. But they aren't, and it does ;-).)
Interesting. Anyway, I grok it now. Thank you both for all your help.
Cheers,
--Rick