Thread

  1. Re: Second RewriteQuery complains about first RewriteQuery in edge case

    Dean Rasheed <dean.a.rasheed@gmail.com> — 2025-11-27T19:35:28Z

    On Thu, 27 Nov 2025 at 17:55, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
    >
    > On Thu, 27 Nov 2025 at 16:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > >
    > > I do think there's another way we could attack it.  Similarly
    > > to the way VALUES RTEs are either processed or skipped by
    > > checking the rangetable length, we could pass down the length
    > > of the outer query's cteList, and assume that the last N entries
    > > in a product query's cteList have already been processed.
    > > (Last N not first N because of the order in which the lists are
    > > concatenated at line 596.)  Maybe that's too fragile, but the
    > > approach seems to have worked all right for VALUES.
    >
    
    Here's an update, doing it that way. It does appear somewhat neater.
    
    Regards,
    Dean