Propagate disabled_nodes to single-child Append paths

create_append_path() skips cost_append() when an Append has exactly
one child whose parallel awareness matches its own, since setrefs.c
strips such an Append out entirely.  In that case it copies the
child's rowcount and costs directly, but it failed to copy
disabled_nodes.  An Append over a disabled child therefore claimed to
contain no disabled nodes, letting a disabled path win over one that
is not disabled.

This is a regression in v18; before e22253467, disable_cost was folded
into a path's startup and total costs, so it rode along in the fields
this shortcut already copies.

Back-patch to v18.  This can change plans in stable branches, but only
for installations that have explicitly disabled a node type, and only
to stop using the node they asked us to avoid.

Reported-by: Man Zeng <[email protected]>
Author: Tender Wang <[email protected]>
Reviewed-by: Richard Guo <[email protected]>
Reviewed-by: David Rowley <[email protected]>
Discussion: 
https://postgr.es/m/cahewxnm_zx5edoad7wo7bq6cfrronzns+rbczt_p2-cwqxp...@mail.gmail.com
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/de5659440dbcfe0ef61b474cec0e5ec50a9c3841

Modified Files
--------------
src/backend/optimizer/util/pathnode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Reply via email to