| From: | Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com> |
|---|---|
| To: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: FIX: BUG #19687: ALTER SEQUENCE missing lock |
| Date: | 2026-09-15 08:47:17 |
| Message-ID: | CAE8JnxPvd0XnDN85TnbWu6TnSdENoYcKY7phmafRpo9Ycxf_gQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Sep 15, 2026 at 9:00 AM Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
wrote:
> Hi,
>
> On Tue, 15 Sept 2026 at 12:19, Alexandre Felipe <
> o(dot)alexandre(dot)felipe(at)gmail(dot)com> wrote:
> >
> > Trying to do something different today.
> >
> > Hunting bugs.
> >
> > Addressing an issue in `ALTER SEQUENCE` commands [1], by adding
> > a missing lock when calling RelationSetNewRelfilenumber and being
> > more accurate about the type of lock required in that function's
> doc-comment.
> >
> > The change is sound, even if it is not the complete fix yet.
>
> I posted about the same bug on pgsql-bugs yesterday [2] (quoted below),
> so maybe it is better to keep this in one thread.
>
Transaction conflict, my bad :(
I tried locking at the RelationSetNewRelfilenumber() call first, but it
> deadlocks. ALTER still holds ShareRowExclusiveLock while it waits for the
> upgrade, and that conflicts with the RowExclusiveLock a scanning
> transaction needs for nextval():
>
Callers elsewhere, even in sequence.c, already lock before calling it,
so acquiring a lock in RelationSetNewRelfilenumber will definitely deadlock.
Regards,
Alexandre
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-09-15 08:52:32 | Re: Several issues with postgres_fdw stats import |
| Previous Message | Henri GASC | 2026-09-15 08:44:03 | Re: [SQL/PGQ] Native executor for Graph query |