Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wF8bg-004mSi-2M for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 10:45:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wF8bf-0084sH-3D for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 10:45:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wF8bf-0084s8-20 for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 10:45:27 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wF8bd-000000024Rm-22Ns for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 10:45:26 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-43d7645adbdso2248619f8f.1 for ; Tue, 21 Apr 2026 03:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776768324; cv=none; d=google.com; s=arc-20240605; b=heipiIzw8L0qKfNbqIv/Is2NUZ1scGgutY5v7UaETqtUTdc+/O3aVRTtwu7yUmI7SE Nmp+eRPn9YcsPS9vgmBJYa4APzbs/Fyp0W+5MoGrVaI4o42sZRlXEnnT77NFtl5p840F 34/zInFrsnFsKsm881oZvCJBfZCMpEDNgRn9deVIIyQGpRU3cY+JFPdBfA9bXgyVADL8 8XN87cw0WlcbZRt7iX0OZFBITXKb2WUplGgahYyYD4wGdefhLXHIFMbWwd5anwZbW97y KH7bOFtSGSz/+0a/ZOhYVrJV+wYKQsKy7oBC4kFrDSRKg6LchQRUxIVNnjprVLmrGkkw 2Mzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=vv/FGAiJJBTiaNPqbybSRE80lElwBcxRTcvjI7Hw/3s=; fh=WxRRtFKH80NcfBDlXs47MN1JzhGO46+K9YQIVWbgTLI=; b=N6aQQ6nUoXH7JVxvQxQxOAyTFY2d1JQSeYPxqs63oIM7tE97hu/FBLafNx2D9lndGm HGeSJq5f9SDA62yp7mZsQ1f+ZqcJzF42CeSdvM9voL1A3rUJFh2xwPV0x2qh8/WxNDeD 4pZDLBBsFqe0EE8+GjgVigbR19x8qCnaX1IHXC9CSbI5CL/IrSnkMZdzro763bCqVdzv BYHbSaRhOmUw9JgEVY+jOyMk3SHEY3QyI9JUtUo/ad5Y5E8d1i+AHowoFgBjjbMh7cM3 CFNb2BlrV15kfngYwJ+UKVsCShHfPD9I3JhCoepGlD3RYlwtrNyg13L0XElNet/Rttg7 113g==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776768324; x=1777373124; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vv/FGAiJJBTiaNPqbybSRE80lElwBcxRTcvjI7Hw/3s=; b=K4EF82jm+7izxDEWrsedx02tK5Y1CLVkHwp7EC7NKxOY5xrkZB1TicvQe508vwyTM2 UM0ut7WgJaopJyfag8Xl09vGE2eXvNIKAQd7Cqm99KtoIrD0RtN7AYe2/Nvz6Sp32Hap wGZ3K7sDqCLLMCliOp7LFsyH8EjRa3DUIFIEycT+T1k3UUUpNYxEvcDqXrBEbZIhmbwa ek6hoW9BGuJmd5JYOdehkn1fJAqHXEPvlSE0egUYKpvsTk6bEPh+Mr0EpHLNZBy++rmr C3u2DCUsbWjgFrNOAn4pV9D5mkRlcd+pjdyLsH0/d7EDfQt/CZnrzGZTUY4JjCcDBLg8 8ETw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776768324; x=1777373124; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vv/FGAiJJBTiaNPqbybSRE80lElwBcxRTcvjI7Hw/3s=; b=CgyzlriENIOgdayQWuCRsOM2xE162CKQpMLT1eoyiJekxg00TVUNy0GsWC+eSUgWzE xhcAp0hfEjs+nUwYszmzEgPKW8gn9KT7FaSqiAECXyJIepZ7BAyXltI710w9bajfMC4C tdt4dck/iAittJ2ohOPInrjx1rliNnsRpzw+V+Ox5qp+hv3XOhPwv8f95aqfCpDLYME4 W81uYQ0Od9zN6zEtP0H/+zshILxz2Vfxo9CgLceK6YvuDBGhWSZN722sbHc1XLGpQeG4 kcTqbynYRjtOh2x9YBl+poYToCnxUSDfncpHBAcneQSJoZzvOzMmzHHuMLUGYIzANGs7 hTdg== X-Gm-Message-State: AOJu0YyGYT0kUCAwayCm1cuF99KiQUJCvFgpI2IsvvoZvtYtJq8ZG/h2 826zbyTQfqsyzx9xtF6ftB5/Rx5/6BfS3pBvH4YtjBaGqKdRfWrsRJCOyofO5dj77h6zXeK4jpN tdKG/sCy4rgGyjjGdPED/b7vrUFlAp2w= X-Gm-Gg: AeBDietoST+jAJwe0Y/HeqoNV+r8XP6HkbKEuB7QIrE/6cv3cqEAEcNG68eQchQ6Wtm 6gpazzy1mCxljFvOLk/Sn5gcvqP709jdzodPuXHum8jSetQ4h46gJL7KonakBglEpTkpEiiGLcR E2hmm0P6upOwf7sTrfBnz/5KQz1pWkyR01SNiQctQIWQEAiRL04xQtpcYsjIbqEsk50r6pm1SLz TLjrjfRVCAI7US3v5Y3f0W89J29UEkNHmsRanOPR7FWG1kEwTAErIsBVvrw/uv3DgCYY4gyRj2i K3GNcPBQNqyp6FHiXrWnsIqC8SgLxXedTlXuPcpikfamA+XocZNEhQDze+Y45PLNC8ZYGLAn4DA /lntryzrm X-Received: by 2002:a05:6000:1785:b0:43c:fc5c:a9fe with SMTP id ffacd0b85a97d-43fe3dbf4e7mr26697065f8f.20.1776768324103; Tue, 21 Apr 2026 03:45:24 -0700 (PDT) MIME-Version: 1.0 References: <20be3d9d-4147-492a-b69c-d69a87a014a9@gmail.com> <1b67f95c-27a5-42dd-8c95-efe452094dc3@gmail.com> In-Reply-To: <1b67f95c-27a5-42dd-8c95-efe452094dc3@gmail.com> From: David Rowley Date: Tue, 21 Apr 2026 22:45:10 +1200 X-Gm-Features: AQROBzCnfn-RkM5ft8XXncOuNTviQZ8zC9Gbs6BCv3jsZi0QnrovhhwAc5wtvPo Message-ID: Subject: Re: A very quick observation of dangling pointers in Postgres pathlists To: Andrei Lepikhov Cc: PostgreSQL Hackers , Tom Lane , "a.rybakina" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 21 Apr 2026 at 20:54, 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. > > 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