Re: Second RewriteQuery complains about first RewriteQuery in edge case - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Second RewriteQuery complains about first RewriteQuery in edge case
Date
Msg-id CAEZATCWfNB6PjQgm_1U-PymE8FAZvSKbC2LntHa3YbYohMtffg@mail.gmail.com
Whole thread Raw
In response to Re: Second RewriteQuery complains about first RewriteQuery in edge case  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, 27 Nov 2025 at 21:40, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Yeah, this looks pretty good.  Two nitpicky suggestions:
>
> * Perhaps using foreach_current_index() would be better than
> adding the separate loop variable "i" in RewriteQuery.

Ah, good point. I'd forgotten about that macro.

> * I think it would be wise to add a comment about this in
> rewriteRuleAction too, perhaps along the lines of
>
> -       /* OK, it's safe to combine the CTE lists */
> +       /*
> +        * OK, it's safe to combine the CTE lists.  Beware that RewriteQuery
> +        * knows we concatenate the lists in this order.
> +        */
>         sub_action->cteList = list_concat(sub_action->cteList,
>                                           copyObject(parsetree->cteList));

Agreed. Done that way.

Thanks for reviewing.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: [PoC] XMLCast (SQL/XML X025)
Next
From: Dean Rasheed
Date:
Subject: Re: Second RewriteQuery complains about first RewriteQuery in edge case