Re: BUG #19037: Planner fails on estimating array length with "no relation entry" error

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19037: Planner fails on estimating array length with "no relation entry" error
Date: 2025-09-01 07:32:43
Message-ID: CAMbWs4_5Q3V_M1FavN07TxcOHhE38vtBaHs-LM2-RN=paYGi-g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Aug 31, 2025 at 6:51 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> The most expedient solution is probably to hack examine_variable
> so that it doesn't fail if root->simple_rel_array isn't there yet.
> That seems mighty ugly though.

As an alternative, I wonder if we could pass root as NULL to
cost_subplan() when it's called from build_subplan(), and possibly
also from SS_process_ctes(). At those points, the root does not yet
contain enough information to safely consult statistics. Meanwhile,
cost_qual_eval() and the functions it calls are already well-equipped
to handle a NULL root.

- Richard

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-09-01 14:57:37 Re: BUG #19037: Planner fails on estimating array length with "no relation entry" error
Previous Message Richard Guo 2025-09-01 06:00:03 Re: BUG #19007: Planner fails to choose partial index with spurious 'not null'