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 1kLoW8-0000nP-O8 for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2020 14:16:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kLoW7-0005nQ-Lw for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2020 14:16:07 +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 1kLoW7-0005nI-FH for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2020 14:16:07 +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 1kLoW5-0002RE-F2 for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2020 14:16:06 +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 08PEG3hW1853889; Fri, 25 Sep 2020 10:16:03 -0400 From: Tom Lane To: Peter Eisentraut cc: Masahiko Sawada , PostgreSQL Hackers Subject: Re: Dumping/restoring fails on inherited generated column In-reply-to: References: <15830.1575468847@sss.pgh.pa.us> <31905.1575491779@sss.pgh.pa.us> <24369.1580758361@sss.pgh.pa.us> <3f272982-0e0d-17a1-3fb6-fedc74197676@2ndquadrant.com> <3169466.1594841366@sss.pgh.pa.us> Comments: In-reply-to Peter Eisentraut message dated "Fri, 25 Sep 2020 15:07:53 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1853887.1601043363.1@sss.pgh.pa.us> Date: Fri, 25 Sep 2020 10:16:03 -0400 Message-ID: <1853888.1601043363@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut writes: > The proposed patches will cause the last statement to be omitted, but > that still won't recreate the original state. The problem is that there > is no command to make a column generated afterwards, like the SET > DEFAULT command, so we can't dump it like this. Right. I'm not even sure what such a command should do ... would it run through all existing rows and update them to be the GENERATED value? > We could probably fix this by having ALTER TABLE ONLY / DROP EXPRESSION > update the attlocal column of direct children to true, to make the > catalog state look like something that can be restored. However, that's > a fair amount of complicated code, so for now I propose to just prohibit > this command, meaning you can't use ONLY in this command if there are > children. This is new in PG13, so this change would have very limited > impact in practice. +1. At this point we would want some fairly un-complicated fix for the v13 branch anyhow, and this seems to fit the bill. (Also, having child columns suddenly grow an attislocal property doesn't seem to meet the principle of least surprise.) regards, tom lane