Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> My thought is that we could optimize away materialization in cases where
>> we can tell it's not needed (no volatile functions and/or no multiple
>> scans of the subquery). But not being able to do it means we've
>> implemented the feature incorrectly.
> I'm not sure how much work that would involve, but none of this means we
> can't have the feature for 8.4, right? Just that there is more work to do.
I would be *extremely* surprised if we don't find ourselves improving
the optimization of WITH clauses long after 8.4. We're still working on
outer joins, remember ;-). My point here is just that the base case
before optimization has to behave per spec. Optimizing more later is
good, fixing deliberately introduced non-compliance not so good.
regards, tom lane