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 1mpAjb-0002Av-3R for pgsql-general@arkaria.postgresql.org; Mon, 22 Nov 2021 14:55:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpAjZ-0001Ej-DA for pgsql-general@arkaria.postgresql.org; Mon, 22 Nov 2021 14:55:53 +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 1mpAjZ-0001EZ-2P for pgsql-general@lists.postgresql.org; Mon, 22 Nov 2021 14:55:53 +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 1mpAjW-0007S1-Je for pgsql-general@lists.postgresql.org; Mon, 22 Nov 2021 14:55:52 +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 1AMEtijZ3698209; Mon, 22 Nov 2021 09:55:44 -0500 From: Tom Lane To: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JjQstCw0L3QvtCy?= cc: Adrian Klaver , pgsql-general Subject: Re: pg_dump insert column GENERATED In-reply-to: References: <2ea33714-149f-f614-4cdb-012f252d57c0@aklaver.com> <3443243.1637511849@sss.pgh.pa.us> Comments: In-reply-to =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JjQstCw0L3QvtCy?= message dated "Mon, 22 Nov 2021 09:39:23 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3698207.1637592944.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Nov 2021 09:55:44 -0500 Message-ID: <3698208.1637592944@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =3D?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JjQstCw0L3QvtCy?=3D writes: > Uchet=3D# select attname, attgenerated from pg_attribute > Uchet-# where attrelid =3D 'bpd.object'::regclass and attnum > 0; > attname | attgenerated > -------------------------------+-------------- > id | > id_class | > id_position | > ........pg.dropped.4........ | > ........pg.dropped.5........ | > ........pg.dropped.6........ | > bquantity | > ........pg.dropped.8........ | > ........pg.dropped.9........ | > id_position_root | > id_conception | > barcode_unit | > id_unit_conversion_rule | > ........pg.dropped.14........ | > timestamp | > on_freeze | > timestamp_class | > name | > id_class_root | > id_group | > id_group_root | > id_object_carrier | > desc | > ........pg.dropped.24........ | > ........pg.dropped.25........ | > ........pg.dropped.26........ | > id_class_prop_object_carrier | > id_pos_temp_prop | > ........pg.dropped.29........ | > mc | > is_inside | s Hah ... that gave me the clue I needed. If there are dropped column(s) before the GENERATED one, pg_dump gets it wrong --- but only in --inserts mode, not the default COPY mode, which no doubt explains why nobody noticed. There is code in there to inject DEFAULT, but it must be indexing the flag array wrong. Will fix, thanks for the report! regards, tom lane