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 1kSpWy-0003uO-N1 for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Oct 2020 22:46:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kSpWx-0008Fz-JZ for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Oct 2020 22:45:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSpWx-0008Fs-DP for pgsql-bugs@lists.postgresql.org; Wed, 14 Oct 2020 22:45:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSpWv-0002DZ-5X for pgsql-bugs@lists.postgresql.org; Wed, 14 Oct 2020 22:45:58 +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 09EMjrME3637296; Wed, 14 Oct 2020 18:45:53 -0400 From: Tom Lane To: Peter Eisentraut cc: rad@killian.email, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16671: "generated always as" is ignored when updating table through view In-reply-to: <3634945.1602712174@sss.pgh.pa.us> References: <16671-2fa55851859fb166@postgresql.org> <3634945.1602712174@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 14 Oct 2020 17:49:34 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3637294.1602715553.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 14 Oct 2020 18:45:53 -0400 Message-ID: <3637295.1602715553@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > PG Bug reporting form writes: >> [ updating via a view fails to recalculate GENERATED columns ] > Yeah, that's surely a bug. In fact, it's a regression, because > the test case works as-expected in v12. Not sure where we broke it. git bisect blames c6679e4fca21d253ced84c51ac1a31c1b2aec72f is the first bad commit commit c6679e4fca21d253ced84c51ac1a31c1b2aec72f Author: Peter Eisentraut Date: Mon Feb 17 15:19:58 2020 +0100 Optimize update of tables with generated columns = When updating a table row with generated columns, only recompute those generated columns whose base columns have changed in this update and keep the rest unchanged. This can result in a significant performance benefit. The required information was already kept in RangeTblEntry.extraUpdatedCols; we just have to make use of it. = Reviewed-by: Pavel Stehule Discussion: https://www.postgresql.org/message-id/flat/b05e781a-fa16-6= b52-6738-761181204567@2ndquadrant.com regards, tom lane