Re: pg_plan_advice

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Lukas Fittl <lukas(at)fittl(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Dian Fay <di(at)nmfay(dot)com>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_plan_advice
Date: 2026-01-29 06:44:24
Message-ID: CAMbWs4--NuEUFE_xTo991TRXaZryE29jarJPDnVxoaQOYdt7tA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Wed, Jan 28, 2026 at 6:41 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > skink's not happy:
> >
> > =2162940== VALGRINDERROR-BEGIN
> > ==2162940== Conditional jump or move depends on uninitialised value(s)
> > ==2162940== at 0x434D366: cost_material (costsize.c:2593)
> > ==2162940== by 0x436E7E9: materialize_finished_plan (createplan.c:6531)
> > ==2162940== by 0x4383054: standard_planner (planner.c:533)
> > ...
> > ==2162940== by 0x44CD09D: ProcessUtility (utility.c:525)
> > ==2162940== Uninitialised value was created by a stack allocation
> > ==2162940== at 0x436E76A: materialize_finished_plan (createplan.c:6506)

FWIW, the following related code in reparameterize_path() seems unsafe
to me:

spath = reparameterize_path(root, spath,
required_outer,
loop_count);
enabled =
(mpath->path.disabled_nodes <= spath->disabled_nodes);
if (spath == NULL)
return NULL;
return (Path *) create_material_path(rel, spath, enabled);

I think we should access spath->disabled_nodes until after we have
verified that spath is not NULL.

Also, it's not quite clear to me why create_material_path (and
cost_material) requires the "enabled" parameter. I couldn't find any
comments on this, so it might be worth adding some comments here.

- Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2026-01-29 07:03:29 RE: logical apply worker's lock waits in subscriber can stall checkpointer in publisher
Previous Message Chao Li 2026-01-29 06:36:57 Re: ATPrepCmd: cleanup unreachable AT_AddIndexConstraint handling