Re: Second RewriteQuery complains about first RewriteQuery in edge case

Dean Rasheed <dean.a.rasheed@gmail.com>

From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Bernice Southey <bernice.southey@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Kirill Reshke <reshkekirill@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-29T12:45:20Z
Lists: pgsql-hackers
On Fri, 28 Nov 2025 at 09:21, Bernice Southey <bernice.southey@gmail.com> wrote:
>
> This is neat.
> Should the test be the rules one? Updatable views are more used, but
> your rules example has more coverage.

Yes, I think that's probably better. I've tweaked the test to use both
rules and updatable views, so that it has to deal with more than one
CTE. That way, it validates that we skip already-processed CTEs from
the right end of the list.

Pushed and back-patched.

Regards,
Dean