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 1mLSRs-0005KM-OD for pgsql-general@arkaria.postgresql.org; Wed, 01 Sep 2021 15:46:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mLSRr-0005Hn-LQ for pgsql-general@arkaria.postgresql.org; Wed, 01 Sep 2021 15:46:47 +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 1mLSRr-0005Hf-Bk for pgsql-general@lists.postgresql.org; Wed, 01 Sep 2021 15:46:47 +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 1mLSRp-0002xb-8O for pgsql-general@lists.postgresql.org; Wed, 01 Sep 2021 15:46:47 +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 181FkfFr2077431; Wed, 1 Sep 2021 11:46:41 -0400 From: Tom Lane To: =?UTF-8?Q?FOUTE_K=2E_Jaur=C3=A8s?= cc: Adrian Klaver , PostgreSQL General Subject: Re: PostgreSQL 12 - ERROR: invalid attribute number 2 for ad_user_pkey - Urgent In-reply-to: References: <0ff189d1-4418-a33e-631e-f289db51ef10@aklaver.com> Comments: In-reply-to =?UTF-8?Q?FOUTE_K=2E_Jaur=C3=A8s?= message dated "Wed, 01 Sep 2021 16:35:18 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2077429.1630511201.1@sss.pgh.pa.us> Date: Wed, 01 Sep 2021 11:46:41 -0400 Message-ID: <2077430.1630511201@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?UTF-8?Q?FOUTE_K=2E_Jaur=C3=A8s?= writes: > For all table except the pg_catalo table. > The dump on the database is not possible too. (pg_dump: error: invalid > column numbering in table "xxxxxx") It seems that pg_attribute is messed up. If you are really lucky, it might be only a problem in pg_attribute's indexes, in which case reindexing pg_attribute would fix it. However, I recommend proceeding on the assumption that you have possibly-irrecoverable damage. Before you do ANYTHING, make a complete filesystem-level backup of the cluster (stop the server, then do "tar cf backup.tar $PGDATA" or equivalent). Even if reindexing pg_attribute seems to fix it, I'd counsel then doing a pg_dump and restore, in hopes of curing any other problems that may have stemmed from the same root cause. Speaking of root cause, have you had any crashes lately? Is your Postgres up-to-date? How about the underlying OS? regards, tom lane