Re: A very quick observation of dangling pointers in Postgres pathlists

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "a(dot)rybakina" <a(dot)rybakina(at)postgrespro(dot)ru>
Subject: Re: A very quick observation of dangling pointers in Postgres pathlists
Date: 2026-04-21 10:45:10
Message-ID: CAApHDvrtG3KLZYvGc-u+w2nvJVjVD5YfZ3YKY9Fc+zSGXX0Y4w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 21 Apr 2026 at 20:54, Andrei Lepikhov <lepihov(at)gmail(dot)com> wrote:
>
> On 21/04/2026 10:35, David Rowley wrote:
> > IMO, we should write a function like copy_path() or reparent_path(),
> > which creates a copy of the given Path, or the latter also would copy
> > then set the ->parent to the given RelOptInfo. Any time we use a path
> > directly from the pathlist of another RelOptInfo, we should reparent
> > or copy it. We could add an Assert in add_path() to check the new path
> > has the correct parent to help us find the places where we forget to
> > do this.
>
> It would be great to have a copy_path() function. At the moment, I create a
> limited version each time in an extension module, using
> reparameterize_path_by_child as a guide since it ensures the core can handle
> path copies.
> Do you mean we can introduce such a copy routine to fix current issue? Here is
> the problem: dangling pointers are detected only by external tools. I can't
> imagine an SQL reproducer to test this machinery.

I had anticipated that we'd only fix in master as we'd probably need a
new callback in CustomPathMethods.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-04-21 10:50:59 Re: Bug: trailing comma syntax error in postgres_fdw fetch_attstats()
Previous Message Evgeny Voropaev 2026-04-21 10:41:00 Re: Exit walsender before confirming remote flush in logical replication