Re: BUG #19968: ALTER COLUMN TYPE fails with internal errors if a dependent object is dropped concurrently

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Aman Ganapathy <aman(at)stack-auth(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19968: ALTER COLUMN TYPE fails with internal errors if a dependent object is dropped concurrently
Date: 2026-12-04 05:00:14
Message-ID: CALdSSPge5r_ecxzs9yjrd92CRnZnnH1=VMfBcUq5-rJfr_LQTA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 4 Dec 2026 at 07:57, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> On Thu, 3 Dec 2026 at 23:58, Aman Ganapathy <aman(at)stack-auth(dot)com> wrote:
> >
> > Hi,
> >
> > Thanks for taking a look! I've attached a patch and a potential test.
> >
> > RememberAllDependentForRebuilding() doesn't lock the objects it sees in
> > pg_depend, so if something is dropped in between, the lookup fails.
> > 0001 looks them up with missing_ok = true and skips the ones that are
> > gone, since an object that has been dropped no longer uses the column.
> > If the object is still there, you get the same error as before.
> >
> Your isolation test reproduces the issue, unpatched binary runs with
> ERROR: could not find tuple for rule for me . Fix looks ok
>

Putting this on a second thought, I can agree we should avoid XX000
error code in sql-reachable scenarios, but for 0A000 (your drop
function case) - why not to leave everything as-is?
If somebody drops functions concurrently with an alter type and
receives an error due to race - a simple retry would make everything
done, and your NULL guard would not prevent all types of races of this
kind anyway, so why bother at all?

--
Best regards,
Kirill Reshke

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ishjaap Singh 2026-12-04 06:43:17 Re: BUG #19851: Adding a tautological CHECK(true) to a domain changes JSON_VALUE's result (silent NULL, value/type c
Previous Message Amit Langote 2026-12-04 04:48:49 Re: BUG #19851: Adding a tautological CHECK(true) to a domain changes JSON_VALUE's result (silent NULL, value/type c