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 1qonpa-002xv4-6r for pgsql-general@arkaria.postgresql.org; Fri, 06 Oct 2023 16:37:38 +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 1qonpX-009HY4-Ci for pgsql-general@arkaria.postgresql.org; Fri, 06 Oct 2023 16:37:36 +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.94.2) (envelope-from ) id 1qonpX-009HXw-17 for pgsql-general@lists.postgresql.org; Fri, 06 Oct 2023 16:37:35 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qonpS-000coG-F6 for pgsql-general@lists.postgresql.org; Fri, 06 Oct 2023 16:37:35 +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 396GbPWx2970697; Fri, 6 Oct 2023 12:37:25 -0400 From: Tom Lane To: "David G. Johnston" cc: Adrian Klaver , Ron , pgsql-general@lists.postgresql.org Subject: Re: why generated columsn cannot be used in COPY TO? In-reply-to: References: <2949797.1696600071@sss.pgh.pa.us> <8cebb434-d1ff-2744-1ad0-63816019df04@a-kretschmer.de> <7f80a4a3-af51-6863-b72d-bee1118b8f79@gmail.com> <4edb5259-10e6-4103-9d4b-9d63992a6a91@aklaver.com> Comments: In-reply-to "David G. Johnston" message dated "Fri, 06 Oct 2023 09:08:02 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2970695.1696610245.1@sss.pgh.pa.us> Date: Fri, 06 Oct 2023 12:37:25 -0400 Message-ID: <2970696.1696610245@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: >> On 10/6/23 08:45, Ron wrote: >>> Nah. "The programmer -- and DBA -- on the Clapham omnibus" quite >>> reasonably expects that COPY table_name TO (output)" copies all the >>> columns listed in "\d table_name". > Sure, but it doesn't. Mainly since copy's original design was intended to > solve the dump/restore problem and it doesn't make sense to specify data > for inbound generated data. So while we do have a POLA violation here the > desirability to now fix it years later is basically zero. And the current > behavior is at least defensible and consistent. And there is a very easy > way to get the desired output making any change that much harder a sell. Changing the default behavior now is certainly a non-starter. I don't really see any backwards-compatibility problem with allowing cases that had been errors, though. regards, tom lane