Fujii Masao <[email protected]> 于2026年9月16日周三 13:16写道:
>
> On Wed, Sep 16, 2026 at 9:39 AM Richard Guo <[email protected]> wrote:
> > Thanks for the report! I expected some fallout from this commit,
> > though I didn't expect them quite so soon :-)
> >
> > I'll take a look.
>
> Thanks!
>
> And, here's another related issue, though it seems to have been introduced by
> commit 2ebf25e7d70.
>
>
> CREATE TABLE t(a integer PRIMARY KEY);
>
> EXPLAIN (COSTS OFF)
> SELECT u.c2
> FROM (
> SELECT CASE WHEN false THEN r.a END AS c
> FROM t l LEFT JOIN t r ON l.a = r.a
> ) s
> RIGHT JOIN t b ON true
> CROSS JOIN LATERAL (
> SELECT (SELECT s.c) AS c2
> UNION ALL
> SELECT (SELECT s.c)
> ) u;
>
It seems root->append_rel_list was not processed in preprocess_subquery_phvs().
I tried a quick fix as follows:
diff --git a/src/backend/optimizer/plan/planner.c
b/src/backend/optimizer/plan/planner.c
index 8d30131855a..fa15855411b 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -1643,6 +1643,9 @@ preprocess_subquery_phvs(PlannerInfo *root)
context.sublevels_up = 0;
(void) query_tree_walker(root->parse, preprocess_subquery_phvs_walker,
&context, 0);
+ if (root->append_rel_list != NIL)
+ (void) expression_tree_walker((Node *)
root->append_rel_list, preprocess_subquery_phvs_walker,
+ &context);
}
--
Thanks,
Tender Wang