Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Cc: Daniil Davydov <3danissimo(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Alexander Lakhin <exclusion(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>
Subject: Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION
Date: 2025-07-03 15:06:59
Message-ID: 20250704000659.930b9b977165cb7ac693cb09@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 3 Jul 2025 23:18:12 +0900
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:

> On Tue, 1 Jul 2025 18:56:11 +0700
> Daniil Davydov <3danissimo(at)gmail(dot)com> wrote:

> > For example, with this patch such a query : "CREATE TYPE mood AS ENUM
> > ('happy', 'sad', 'happy');"
> > Will throw this error : "operation failed due to a concurrent command"
> > Of course, it isn't true
>
> You're right ― this error is not caused by a concurrent command.
> However, I believe the error message in cases like creating an ENUM type with
> duplicate labels could be improved to explain the issue more clearly, rather
> than just reporting it as a unique constraint violation.

I have submitted a patch addressing this in a separate thread [1].

[1] https://www.postgresql.org/message-id/20250704000402.37e605ab0c59c300965a17ee%40sraoss.co.jp

Regards,
Yugo Nagata

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhou, Zhiguo 2025-07-03 15:38:32 Re: Optimize LWLock scalability via ReadBiasedLWLock for heavily-shared locks
Previous Message Yugo Nagata 2025-07-03 15:04:02 Improve error message for duplicate labels in enum types