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.94.2) (envelope-from ) id 1tzmYC-006blN-J3 for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Apr 2025 01:05:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tzmYB-008b1i-8l for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Apr 2025 01:05:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzmYA-008b1X-Vo for pgsql-hackers@lists.postgresql.org; Wed, 02 Apr 2025 01:05:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tzmY9-002SYB-1N for pgsql-hackers@postgresql.org; Wed, 02 Apr 2025 01:05:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53215mfr706573; Tue, 1 Apr 2025 21:05:48 -0400 From: Tom Lane To: Alexander Lakhin cc: jian he , PostgreSQL-development Subject: Re: bug when apply fast default mechanism for adding new column over domain with default value In-reply-to: <025a3ffa-5eff-4a88-97fb-8f583b015965@gmail.com> References: <2901599.1740811424@sss.pgh.pa.us> <3086966.1740873261@sss.pgh.pa.us> <3519325.1740953319@sss.pgh.pa.us> <3664075.1741018726@sss.pgh.pa.us> <4060266.1741027118@sss.pgh.pa.us> <025a3ffa-5eff-4a88-97fb-8f583b015965@gmail.com> Comments: In-reply-to Alexander Lakhin message dated "Tue, 01 Apr 2025 21:00:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <706571.1743555948.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 01 Apr 2025 21:05:48 -0400 Message-ID: <706572.1743555948@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Lakhin writes: > I've discovered that 95f650674 introduced a defect similar to bug #18297, > but this time with DEFAULT. Namely, the following script: > CREATE TABLE a (aa text); > CREATE TABLE c (cc text) INHERITS (a); > CREATE TABLE d (dd text) INHERITS (c, a); > ALTER TABLE a ADD COLUMN i int DEFAULT 1; > fails with: > ERROR:  XX000: tuple already updated by self > LOCATION:  simple_heap_update, heapam.c:4421 Hmm, yeah. The failing call is here: /* Bump the existing child att's inhcount */ ... CatalogTupleUpdate(attrdesc, &tuple->t_self, tuple); so I think you're right that that code path is now short a CommandCounterIncrement() somewhere. I'll look tomorrow if nobody beats me to it. regards, tom lane