Re: BUG #19037: Planner fails on estimating array length with "no relation entry" error
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2025-09-02T06:49:51Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix planner error when estimating SubPlan cost
- 8c02d92c6475 13.23 landed
- 160ef51c8dba 14.20 landed
- 53e35fb560ab 15.15 landed
- 79ade5873232 16.11 landed
- f34202f51867 17.7 landed
- ab4a35b4ea9d 18.0 landed
- aba8f61c3091 19 (unreleased) landed
Attachments
- v2-0001-Fix-planner-error-when-estimating-SubPlan-cost.patch (application/octet-stream) patch v2-0001
On Mon, Sep 1, 2025 at 11:57 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > I'm slightly tempted to do the dirty work in cost_subplan() itself, > ie pass a NULL down to cost_qual_eval from there. Right now it > doesn't matter, but maybe in future there would be some other > safer use for the parent root in cost_subplan()? Fair point. > This approach > would force the same behavior for the third caller of cost_subplan, > SS_make_initplan_from_plan. But I don't think it matters there, > since an initplan will by definition not be consulting anything from > the parent plan. Yeah, it should be safe to use a NULL root for initplans. Besides, in the case of SS_make_initplan_from_plan, testexpr will be NULL, and cost_qual_eval() becomes a no-op. Here is the patch that passes root as NULL to cost_qual_eval() in cost_subplan(), along with some commentary about why. - Richard