Re: A very quick observation of dangling pointers in Postgres pathlists - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Re: A very quick observation of dangling pointers in Postgres pathlists
Date
Msg-id 6f6fa20f-1019-4bf6-ab76-c30c046b0efe@gmail.com
Whole thread
In response to Re: A very quick observation of dangling pointers in Postgres pathlists  (Andrei Lepikhov <lepihov@gmail.com>)
List pgsql-hackers
On 27/04/2026 10:19, Andrei Lepikhov 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.
> 
> I've attached the patch so we can keep the discussion going.

While playing with random path choices [1], I found additional cases where a
path is assigned to two different RelOptInfos. See the attachment for a modified
patch.

[1] https://github.com/danolivo/pg-chaos-test

-- 
regards, Andrei Lepikhov,
pgEdge
Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Changing the state of data checksums in a running cluster
Next
From: Chao Li
Date:
Subject: Re: [Bug][patch]: After dropping the last label from a property graph element, invoking pg_get_propgraphdef() triggers an assertion failure