Re: Second RewriteQuery complains about first RewriteQuery in edge case

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Bernice Southey <bernice(dot)southey(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Second RewriteQuery complains about first RewriteQuery in edge case
Date: 2025-11-27 21:40:14
Message-ID: 359738.1764279614@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> Here's an update, doing it that way. It does appear somewhat neater.

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.

* 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));

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-11-27 22:25:24 Re: https://cfbot.cputube.org - certificate has expired
Previous Message Peter Smith 2025-11-27 21:03:45 Re: CREATE/ALTER PUBLICATION improvements for syntax synopsis