Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, jian he <jian(dot)universality(at)gmail(dot)com>
Subject: Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION
Date: 2025-06-03 08:39:50
Message-ID: 20250603173950.8eecb99b3e1922314d69f65c@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 27 May 2025 09:00:01 +0300
Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:

> Hello Yugo,
>
> 31.03.2025 14:22, Yugo Nagata wrote:
> >> I found that multiple sessions concurrently execute CREATE OR REPLACE FUNCTION
> >> for a same function, the error "tuple concurrently updated" is raised. This is
> >> an internal error output by elog, also the message is not user-friendly.
> > I also found the same error is raised when concurrent ALTER FUNCTION commands are
> > executed. I've added a patch to fix this in the similar way.
>
> FWIW, the same error is raised also with concurrent GRANT/REVOKE on a
> database:
> https://www.postgresql.org/message-id/18dcfb7f-5deb-4487-ae22-a2c16839519a%40gmail.com
>
> Maybe you would also find relevant this thread:
> https://www.postgresql.org/message-id/flat/ZiYjn0eVc7pxVY45%40ip-10-97-1-34.eu-west-3.compute.internal

Thank you for sharing the information.

I know there are other scenarios where the same is raises and I agree that
it would be better to consider a more global solution instead of addressing
each of them. However, I am not sure that improving the error message for
each case doesn't not make sense.

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2025-06-03 08:57:11 Re: Add log_autovacuum_{vacuum|analyze}_min_duration
Previous Message Fujii Masao 2025-06-03 08:28:14 Re: Suggestions for improving \conninfo output in v18