Re: Bug in query rewriter - hasModifyingCTE not getting set

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Nancarrow <gregn4422@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-02-07T00:05:11Z
Lists: pgsql-hackers

Attachments

After poking around a bit more, I notice that the hasRecursive flag
really ought to get propagated as well, since that's also an attribute
of the CTE list.  That omission doesn't seem to have any ill effect
today, since nothing in planning or execution looks at that flag, but
someday it might.  So what I think we should do is as attached.
(I re-integrated your example into with.sql, too.)

Given the very limited time remaining before the release wrap, I'm
going to go ahead and push this.

			regards, tom lane

Commits

  1. Fix rewriter to set hasModifyingCTE correctly on rewritten queries.

  2. Enable parallel SELECT for "INSERT INTO ... SELECT ...".

  3. Revert "Propagate CTE property flags when copying a CTE list into a rule."

  4. Propagate CTE property flags when copying a CTE list into a rule.