Disallow concurrent ALTER DOMAIN and DROP DOMAIN

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Disallow concurrent ALTER DOMAIN and DROP DOMAIN
Date: 2025-05-23 13:19:07
Message-ID: CACJufxG_Puz=iq_sjhmJf1LZjMAt96vOagGuUuBoUKGuNknWeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi

similar to thread "Prevent internal error at concurrent CREATE OR
REPLACE FUNCTION"
[1].

We should prevent concurrent modifications to a domain's definition. Currently,
it is possible for one session to drop a domain while another session
simultaneously adds a constraint to it.
It may result in errors such as "tuple concurrently updated."

also dropping a domain should not be allowed if another session is
modifying it, IMHO.

The attached patch is very similar to the "CREATE OR REPLACE FUNCTION"
thread [1],
by acquiring a AccessExclusiveLock on the changed domain oid.
Other sessions must wait for the current transactions to finish
modifying the domain definition
before making changes on it.

[1] https://postgr.es/m/20250331200057.00a62760966a821d484ea904@sraoss.co.jp

Attachment Content-Type Size
v1-0001-fix-concurrent-issue-in-ALTER-DOMAIN.patch text/x-patch 7.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2025-05-23 13:37:42 Re: PG 18 release notes draft committed
Previous Message Erik Nordström 2025-05-23 13:18:04 Re: Relstats after VACUUM FULL and CLUSTER