postgresql/src/backend
Tom Lane 88ceac5d77 Fix parallel-safety marking when moving initplans to another node.
Our policy since commit ab77a5a45 has been that a plan node having
any initplans is automatically not parallel-safe.  (This could be
relaxed, but not today.)  clean_up_removed_plan_level neglected
this, and could attach initplans to a parallel-safe child plan
node without clearing the plan's parallel-safe flag.  That could
lead to "subplan was not initialized" errors at runtime, in case
an initplan referenced another one and only the referencing one
got transmitted to parallel workers.

The fix in clean_up_removed_plan_level is trivial enough.
materialize_finished_plan also moves initplans from one node
to another, but it's okay because it already copies the source
node's parallel_safe flag.  The other place that does this kind
of thing is standard_planner's hack to inject a top-level Gather
when debug_parallel_query is active.  But that's actually dead
code given that we're correctly enforcing the "initplans aren't
parallel safe" rule, so just replace it with an Assert that
there are no initplans.

Also improve some related comments.

Normally we'd add a regression test case for this sort of bug.
The mistake itself is already reached by existing tests, but there
is accidentally no visible problem.  The only known test case that
creates an actual failure seems too indirect and fragile to justify
keeping it as a regression test (not least because it fails to fail
in v11, though the bug is clearly present there too).

Per report from Justin Pryzby.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/ZDVt6MaNWkRDO1LQ@telsasoft.com
2023-04-12 10:46:38 -04:00
..
access Fix incorrect format placeholders 2023-04-12 10:05:50 +02:00
archive Redesign archive modules 2023-02-17 14:26:42 +09:00
backup Support long distance matching for zstd compression 2023-04-06 17:18:42 +02:00
bootstrap Fix CREATE INDEX progress reporting for multi-level partitioning. 2023-03-25 15:34:03 -04:00
catalog Revert "Add support for Kerberos credential delegation" 2023-04-08 07:21:35 -04:00
commands Improve ereports for VACUUM's BUFFER_USAGE_LIMIT option 2023-04-11 19:36:34 +12:00
executor Fix row tracking in pg_stat_statements with extended query protocol 2023-04-06 09:29:03 +09:00
foreign Revert "Add support for Kerberos credential delegation" 2023-04-08 07:21:35 -04:00
jit SQL/JSON: support the IS JSON predicate 2023-03-31 22:34:04 +02:00
lib Fix ILIST_DEBUG build 2023-01-18 10:26:15 -08:00
libpq Revert "Add support for Kerberos credential delegation" 2023-04-08 07:21:35 -04:00
main Mark options as deprecated in usage output 2023-03-02 14:36:37 +01:00
nodes Catalog NOT NULL constraints 2023-04-07 19:59:57 +02:00
optimizer Fix parallel-safety marking when moving initplans to another node. 2023-04-12 10:46:38 -04:00
parser Fix uninitialized variable in transformTableLikeClause() 2023-04-11 23:01:12 +12:00
partitioning Add SysCacheGetAttrNotNull for guaranteed not-null attrs 2023-03-25 22:49:33 +01:00
po meson: add install-{quiet, world} targets 2023-03-23 21:20:18 -07:00
port Update copyright for 2023 2023-01-02 15:00:37 -05:00
postmaster Add VACUUM/ANALYZE BUFFER_USAGE_LIMIT option 2023-04-07 11:40:31 +12:00
regex Redesign interrupt/cancel API for regex engine. 2023-04-08 22:10:39 +12:00
replication Allow logical decoding on standbys 2023-04-08 02:20:05 -07:00
rewrite Fix more bugs caused by adding columns to the end of a view. 2023-03-07 18:21:53 -05:00
snowball Update copyright for 2023 2023-01-02 15:00:37 -05:00
statistics Add SysCacheGetAttrNotNull for guaranteed not-null attrs 2023-03-25 22:49:33 +01:00
storage Handle logical slot conflicts on standby 2023-04-08 00:05:44 -07:00
tcop Handle logical slot conflicts on standby 2023-04-08 00:05:44 -07:00
tsearch Update tsearch regex memory management. 2023-04-08 22:09:17 +12:00
utils Fix incorrect format placeholders 2023-04-12 10:05:50 +02:00
.gitignore
Makefile Redesign archive modules 2023-02-17 14:26:42 +09:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
nls.mk NLS: Put list of available languages into LINGUAS files 2022-07-13 08:19:17 +02:00