Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcXSG-003QrA-0u for pgsql-bugs@arkaria.postgresql.org; Wed, 24 Jun 2026 23:56:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcXSE-0035oK-23 for pgsql-bugs@arkaria.postgresql.org; Wed, 24 Jun 2026 23:56:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcXSE-0035oC-14 for pgsql-bugs@lists.postgresql.org; Wed, 24 Jun 2026 23:56:26 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wcXSC-000000006u8-0ugK for pgsql-bugs@lists.postgresql.org; Wed, 24 Jun 2026 23:56:26 +0000 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-48670d35a87so207384b6e.1 for ; Wed, 24 Jun 2026 16:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782345382; cv=none; d=google.com; s=arc-20260327; b=BhpheSXqmjVuEvA8m9Wl+jqN3MsWnUVyrGK6/B4TqU+0hSx9BWo5yOQOGYA2lclLiX 9umGDZq0xBh82sb7b8w9bKCEDfL5YflVPX9KlqIkBS/HLUPdefpYYtkaHdUAW1j29u/H +EPNrLrekkAMztuCSgUBv8hGzYEJoloooJfkyOpz9kmF4jdnDdpsPBWvwYSDttVEwJvv gQmVG+DUk6SaN23Z/AqtU+oSTzTJYtG7yCXzF/q3IZoWKpZqgHU3H7LGNsZ+breDU3iM 1v8pJZrWiJBTGsqNzMkmkW7OpAynp+04AiGwNL499ZAo33aPUz+Il05F0rhiUskFNUVg IUcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=MMQcgCX68J6Am/l+Nu2xrCB0HxRu7/54I+5Gtgnkcmk=; fh=vB+szYkVlabyOMiP24DdAHiaOg4+sp6iJmzPTbUF7b4=; b=gvWLMfVByaH89YPiGquxWi9Vm2+hPhwX80kGsxhqX2jDOB9kfVgr8NWyrPJOWmxrNg i4QvWnNM59QlGE4FSsPoEwvmLiIw8kUZvsXcjHqFFrVNlNeyJnsenFgWJ+Cz7Bo0g8kx 7oJ+5/oNDpAvZ9TtUlI1aesj3EP3qTrSYKlmjmMbvrH+MARvhDgDgaXma765B0tRYW5/ Lrw/l1LEfsNGjzTFN1qp46+20CM/w5k4netL7O6v6zhYTSDVoArzIJV/3unbfWAfJCP5 oBfsvvh1noIjXubvGadRqZAOeecu12VhKbwqf1DwQjXZXCGl66xKBhdMGAaLcEIFvoHd kETg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782345382; x=1782950182; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MMQcgCX68J6Am/l+Nu2xrCB0HxRu7/54I+5Gtgnkcmk=; b=kihhwLFrrbwrhxBwZSgTEv4ydR078N+tafPMedh3J7PZkJoqBcbawkjWcO/PpcyXaN T/5Q6T2yHxB90ler7v6NqwG1XOS+ehvXJuApw2jtCqOWzqNlrWfRIBpnP4Oh2i06ikUq 6JeE8InEI1Nh9YY3psQ/w4SbTpvj3R4JLT0Cd+e4TEWVQ76q9H8tctaS5EgIz2B1QxaS HGJLtHNKer2HuOT/MIRlk84Y40L0zDqEFGP17+TXvoHIuuGX2DiwToUQpedmM/6vA4Bi Ck3Jwaua1rg3f9kWq0gkKbhyjoFPdOt+Npw/vsVZk3tRhT9ZTkhhJeSQ6/FiMmjzaKim M2cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782345382; x=1782950182; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MMQcgCX68J6Am/l+Nu2xrCB0HxRu7/54I+5Gtgnkcmk=; b=X1IcMwBJRcn3ZDHZYxys+hQ21tdab1f4y7a+5qIsV6UZnCX7shZceGC6AuT4fmtWQD cIb/0/e0NsskkSWFnKl4m85fOcAH3m3fje7f0hQCvpkXVKOQ9v21H4Jf/3sZz9bTgREt w5/fBdxaFrPHwNAvyI77qEFCK/ecMsB6Vwsok3KmMFLSVPR3F+fMyLsTPB9CUUtLLt5O clIzymVEspFqwhaEP1x/42rYKQvWmictchyoNKS+pUouD3kraDZQ6w7WgtWj7dVg88z7 4WvQt5pCXm5ZusQU7ljTSB4PAA9s0tXLiQkhML/FW/h/CtIjNMRUW9HVlzxrKIDdNx+0 pCeA== X-Gm-Message-State: AOJu0YwccyrKsm1A46xJJS0iDmKtmJYHAXrS6esZb1XBXOTLXYp+5DjF oglTFTurPWFGXqBVuOFjn4PIF+50r9HjdpAJQjg9Z3Gh5/9ZY2tM7dkZ26HOeNVu+CxeCtPuF/Z 295qZhFuDDu4HGba0KlE63ufmV11zhXI= X-Gm-Gg: AfdE7clp3QATKxL7eXzayUO5UGhAfb3w6AYagX0ny6a/tdx81g4wXCqyqxwZyE3Zg4A 5kPeKIVX9BZf39UbQ7GaMHeRGfM1kL+p2ShNjw5RSEffZs/SMpVFLHpxoWyI8LXn76RHxDCQugA 0tkMohmemA9DXRsj3YSK++wgwtaAvWlvE7rlEF0HKvCOtNDA7uETBUemEF2/cs6BgCrhorfBq/T JoXmS4ZFZMlWQWP3FHhBCBXWgokHBbl/mAz8Ml0VkxphvVJ78V0O8XEjBv5y3bOgpdozkRjMrJX 37jDLx7EKoh8Bg== X-Received: by 2002:a05:6808:11d0:b0:48a:a727:8a6f with SMTP id 5614622812f47-49213e5674amr180921b6e.8.1782345381835; Wed, 24 Jun 2026 16:56:21 -0700 (PDT) MIME-Version: 1.0 References: <39977E94-40DD-4176-A191-CE3D120968B2@yandex-team.ru> In-Reply-To: <39977E94-40DD-4176-A191-CE3D120968B2@yandex-team.ru> From: surya poondla Date: Wed, 24 Jun 2026 16:56:10 -0700 X-Gm-Features: AVVi8Cckn8JZOSJpohFJ6H65dCBOl0FafZOrPSzjHov69ZMuNMyhl5AUoyzTNHw Message-ID: Subject: Re: Two bugs around ALTER TYPE To: Andrey Borodin Cc: PostgreSQL mailing lists Content-Type: multipart/alternative; boundary="00000000000059f97d0655089f9e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000059f97d0655089f9e Content-Type: text/plain; charset="UTF-8" Hi Andrey, Thanks for the patch series. I was able to reproduce both bugs on master at HEAD and verified each fix end-to-end: A couple of points: Bug 1: "Number of returned columns (2) does not match expected column count (3) on the second call. With 0002 patch, it returns the new 3-column shape as expected. Bug 2 (with only 0004 patch): Session A returns (1,2), DDL commits after, next call returns (1,2,99). Mechanism works as designed. I also confirmed why glob->relationOids is the right channel rather than glob->invalItems via record_plan_type_dependency(): ALTER TYPE ADD ATTRIBUTE on a composite goes through ALTER TABLE on typrelid and modifies pg_class/pg_attribute but not the composite's pg_type row, so no TYPEOID syscache invalidation fires (CacheInvalidateHeapTuple in AlterDomainAddConstraint). relcache-on-typrelid is the only channel that actually delivers, which is what the patch hooks into. A few comments: 1. 0003 patch alone leaves a permanently-failing TAP test (its expected 1|2|99 is only producible by 0004's lock forcing the DDL to wait). Maybe equash 0003 patch into 0004 patch. 2. alter_table.sql comment says the fix records typrelid in "the plan's invalItems"; it actually goes into glob->relationOids different list, different callback (PlanCacheRelCallback vs PlanCacheObjectCallback). 3. TAP test in 0004 captures $ddl_pid via pg_backend_pid() (lines 68-69) but never uses it. Either we can drop, or use it to assert the DDL session is genuinely waiting on the typrelid in pg_locks (granted=false on AccessExclusiveLock). The latter would directly verify the lock instead of just observing the symptom. Regards, Surya Poondla --00000000000059f97d0655089f9e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Andrey,

Thanks for the patch series. I was a= ble to reproduce both bugs on master at HEAD and verified each fix end-to-e= nd:

A couple of points:
Bug 1: "Number of returned columns (= 2) does not match expected column count (3) on the second call.
With 00= 02 patch, it returns the new 3-column shape as expected.

Bug 2 (with= only 0004 patch): Session A returns (1,2), DDL commits after, next call re= turns (1,2,99). Mechanism works as designed.

=C2=A0=C2=A0
I also = confirmed why glob->relationOids is the right channel rather than glob-&= gt;invalItems via record_plan_type_dependency(): ALTER TYPE ADD ATTRIBUTE <= br>on a composite goes through ALTER TABLE on typrelid and modifies pg_clas= s/pg_attribute but not the composite's pg_type row, so no TYPEOID sysca= che invalidation fires
(CacheInvalidateHeapTuple in AlterDomainAddConstr= aint). relcache-on-typrelid is the only channel that actually delivers, whi= ch is what the patch hooks into.

A few comments:
1. 0003 patch al= one leaves a permanently-failing TAP test (its expected 1|2|99 is only prod= ucible by 0004's lock forcing the DDL to
wait). Maybe equash 0003 pa= tch into 0004 patch.

2. alter_table.sql comment says the fix records= typrelid in "the plan's invalItems"; it actually goes into g= lob->relationOids
different list, different callback (PlanCacheRelCal= lback vs PlanCacheObjectCallback).=C2=A0

3. TAP test in 0004 capture= s $ddl_pid via pg_backend_pid() (lines 68-69) but never uses it.
Either= we can drop, or use it to assert the DDL session is genuinely waiting on t= he typrelid in pg_locks
(granted=3Dfalse on AccessExclusiveLock). The la= tter would directly verify the lock instead of just observing the symptom.<= br>

Regards,
Surya Poondla
--00000000000059f97d0655089f9e--