Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onVL1-0001kC-Rr for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Oct 2022 01:36:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1onVK1-0002N7-OE for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Oct 2022 01:35:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onVK1-0002My-Fc for pgsql-bugs@lists.postgresql.org; Wed, 26 Oct 2022 01:35:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onVJw-0007kU-0y for pgsql-bugs@lists.postgresql.org; Wed, 26 Oct 2022 01:35:08 +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 29Q1Z0Vv144387; Tue, 25 Oct 2022 21:35:00 -0400 From: Tom Lane To: Jeff Janes cc: pgsql-bugs , Peter Eisentraut Subject: Re: generated columns bug, see inconsistent data In-reply-to: References: Comments: In-reply-to Jeff Janes message dated "Tue, 25 Oct 2022 20:58:50 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <144385.1666748100.1@sss.pgh.pa.us> Date: Tue, 25 Oct 2022 21:35:00 -0400 Message-ID: <144386.1666748100@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Janes writes: > I can reproduce the issue in all recent versions (didn't check before 12), > including 15.0 and 16dev. You can see rows in which the generated column > has a value inconsistent with the columns it is generated from. My first guess about this is that we're failing to recalculate generated columns in the EPQ code path where an update is re-applied to a just-modified row. Can you tell whether the inconsistencies are associated with rows that get updated twice in quick succession (by different sessions)? Does the problem go away under serializable mode? > If I copy the core expression of the immutable function into the generated > column expression, leaving the function just for the monitoring query, then > I never see the inconsistency. Maybe that changes the timing? regards, tom lane