Re: Use-after-free of a shared Path in add_path()/add_partial_path()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Use-after-free of a shared Path in add_path()/add_partial_path()
Date: 2026-11-21 19:19:14
Message-ID: 224155.1795288754@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com> writes:
> Richard, are you planning to take this further yourself, or should I
> keep pushing this patch? Just want to avoid duplicated effort.

This same problem was re-reported recently [1], and I rediscovered
basically the same fix, after which Richard pointed out that it's
the same as discussed in this thread. So I've pushed your v2-0001
after some editorialization on the comments. I did not include
a test case, because I have zero faith that the known test cases
are stable enough to reveal the problem after future costing
changes. As far as I can tell, to expose the grouping_planner
problem you need partial paths with fuzzily-equal total cost,
such that add_path and add_partial_path will make different
decisions based on the fact that they don't consider exactly the
same set of secondary factors. Even then, only one of the four
possible choice pairs leads to an observable bug. So that's just
too brittle to be worth expending testing cycles on forevermore.

regards, tom lane

[1] https://stream.boxwatch.ru/message-id/flat/19924-8aecd924385fafcc%40postgresql.org

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message shihao zhong 2026-11-21 19:05:30 Re: Offline data checksum changes can cause incorrect checksum state on standbys