Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION
Date: 2025-05-23 02:37:42
Message-ID: CACJufxECujbwxdrQ8v3QzQWOaj-KpkDCrmA=NDURH5j87=KdQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 22, 2025 at 10:25 AM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
hi.
earlier, i didn't check patch 0002.

i think in AlterFunction add
/* Lock the function so nobody else can do anything with it. */
LockDatabaseObject(ProcedureRelationId, funcOid, 0, AccessExclusiveLock);

right after
funcOid = LookupFuncWithArgs(stmt->objtype, stmt->func, false);

should be fine.

attached are some simple isolation tests for
CREATE OR REPLACE FUNCTION, ALTER FUNCTION, DROP FUNCTION.

Attachment Content-Type Size
v1-0001-isolation-tests-for-concurrent-change-FUNCTION-definition.patch text/x-patch 3.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-05-23 02:49:15 Re: PG 18 release notes draft committed
Previous Message Bruce Momjian 2025-05-23 02:31:29 Re: PG 18 release notes draft committed