| From: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Prevent internal error at concurrent CREATE OR REPLACE FUNCTION |
| Date: | 2025-03-31 11:00:57 |
| Message-ID: | 20250331200057.00a62760966a821d484ea904@sraoss.co.jp |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
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've attached a patch to prevent this internal error by locking an exclusive
lock before the command and get the read tuple after acquiring the lock.
Also, if the function has been removed during the lock waiting, the new entry
is created.
Regards,
Yugo Nagata
--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Prevent-internal-error-at-concurrent-CREATE-OR-REPLA.patch | text/x-diff | 2.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Junwang Zhao | 2025-03-31 11:02:19 | Re: general purpose array_sort |
| Previous Message | Robin Haberkorn | 2025-03-31 10:57:55 | Re: [PATCH] Automatic client certificate selection support for libpq v1 |