Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > Since the problem is using the result of a WITH clause more than once, > would it be sufficient to simply detect that case and bail? You don't > want materialisation is most cases, there's just a few where it is > needed.
Really? I tried googling to see what other people thought that the WITH clause was for, and the first relevant hit I got was this one: http://www.oracle-developer.net/display.php?id=212 which certainly treats it as a key part of the feature. 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. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers