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.96) (envelope-from ) id 1vyBBv-00HW4B-1Z for pgsql-general@arkaria.postgresql.org; Thu, 05 Mar 2026 16:04:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vyBBs-000H5H-0L for pgsql-general@arkaria.postgresql.org; Thu, 05 Mar 2026 16:04:44 +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.96) (envelope-from ) id 1vyBBr-000H52-09 for pgsql-general@lists.postgresql.org; Thu, 05 Mar 2026 16:04:44 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vyBBn-00000000xZu-3FH9 for pgsql-general@lists.postgresql.org; Thu, 05 Mar 2026 16:04:43 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 056BD1400097; Thu, 5 Mar 2026 11:04:38 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Thu, 05 Mar 2026 11:04:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1772726678; x=1772813078; bh=xwEWmVdefoCapdpAdByuApUH0UrqJvypHcqEe9EsBSo=; b= f4SA0XFgpJry7QtrNaOHckmTRohFl912/5BnQiuzd7BSEgCThyK5I6hOgi0Wa4ar zNudP1JbXRFzO52B9W89GyK2x66ELI7tcdnBwdtl19GlCFDWuCYc6VEtuy593VWI A/qmy2Hhy49D1u0YdNMf1f8ryifxghRRh2r18qkhdLrgHsUawat9QMZx6Dp0R6Oh dTOMJ/p1Bdht+8TG4cLfR7f8eaCB4dgo8VrQVIWrzOHefV3cRN0j0pndOZpMY7RN 2OLjq1WSY2XyErEX6+rK2f+puELwntW0jG7tGIRn4mSVxuDmL4WuTM5JJAAaYrre svwfuPlbcivuOzAP2WfkWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1772726678; x= 1772813078; bh=xwEWmVdefoCapdpAdByuApUH0UrqJvypHcqEe9EsBSo=; b=m 0tsVS0OOrfsKjeG1PDz61V/kRUFxCQe+AemrLgbdWxS+kcS1mxXxaily99dBnzeE 5hic4Ny0YsrBGcIrAb11sT3yExIiqe30WWFYxqmNf9oCHhe+cUBtMmXPIxJae/C4 qBwp7EyfKGs74evejkuk5uiTBMiykivFU2gaC/Nf2eI1kr96+hLgZwrsiDkJORAS dHE8ov2u/9jcLBJy8HgQPnuDodgxhVe3ttNiMoXUG5d3Y4DQehq5QONcqEsjE+6g NQyAHXAGBgZkBpaF9uGva6vbasyZ1RsArNE3ynQGBQQS9U4T01cyw7EBvDEsGxbM UZdgBZ/vhYfsux7311Xbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvieeikeduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepheeujeejleehvdfgudfgfeffudelvedtiedtgfetuefg vdektefhudejveegieeinecuffhomhgrihhnpehksggtrdgtohhmnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgv rhesrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtph houhhtpdhrtghpthhtohepfihimhdrrhhouhhquhgrrhhtsehksggtrdgsvgdprhgtphht thhopehhthgrmhhfihgushesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqd hgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 5 Mar 2026 11:04:36 -0500 (EST) Message-ID: <78328b08-249e-4251-8a10-b5dac183442a@aklaver.com> Date: Thu, 5 Mar 2026 08:04:36 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Index (primary key) corrupt? To: Wim Rouquart , Greg Sabino Mullane Cc: "pgsql-general@lists.postgresql.org" References: <5043ff13-2f39-4a80-a8f8-6765746b6a89@aklaver.com> <58221272-d684-4799-a113-d5a5031a0b05@aklaver.com> <25b5291f-a3d3-4655-a3d3-57f28b70ec5a@aklaver.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/5/26 5:23 AM, Wim Rouquart wrote: > Internal > >> So the REINDEX on the source PK is prompted by it not showing up on the target? > > That's how we noticed the initial issue yes, we got errors during the datarefresh on the target database where foreign keys wanted to reference the non-existing index (because it wasn't imported). > >> On the test instance you set up with pg_basebackup and that has the corrupted index what happens if you try to INSERT a record with a duplicate id? > > Good question, as I kind of expected, it doesn't complain at all when I do an insert with a duplicate id (and the row actually gets inserted). If I consecutively try to do the reindex, then I get the error that it can't because of doubles... > > > -----Original Message----- > From: Adrian Klaver > Sent: vrijdag 13 februari 2026 18:33 > To: Wim Rouquart ; Greg Sabino Mullane > Cc: pgsql-general@lists.postgresql.org > Subject: Re: Index (primary key) corrupt? > > > > The real sender of this external email is adrian.klaver@aklaver.com > > > > > > > On 2/13/26 8:27 AM, Wim Rouquart wrote: >> Internal >> >> 1) ) It won't be included with the CREATE TABLE statement per:- >> >> Yes, let's keep it at: it's not in the dumpfile anywhere. >> >>> 2) The issue seems to be not the dump, but the non-functional state of the index on the source database. >> >>> Is there any indication of why that is happening? >> >> Not as far as I know. > > So the REINDEX on the source PK is prompted by it not showing up on the target? > >> >>> Also what error do you get on the source database that tells you the PK is not working? >> >> None, only noticed the issue because of the datarefresh to another instance where it turned out the primary key was not created in the target (because it was not in the dumpfile). > > On the test instance you set up with pg_basebackup and that has the corrupted index what happens if you try to INSERT a record with a duplicate id? Alright, so the corrupt index is transferred by the binary pg_basebackup, but not in logical backups done via pg_dump/pg_restore. The issue then is on the source database with whatever process is corrupting the index and causing no error to be thrown when the table is dumped. Just to be clear we are talking about this table: CREATE TABLE bcf_work_type ( id bigserial NOT NULL, aml_score int8 NOT NULL, CONSTRAINT idx_376814_primary PRIMARY KEY (id) ); What is the use pattern for this table? As I recall this is not a large table, but for completeness what is it's average size? What are the Postgres log settings, on the source database, for?: log_min_messages log_min_error_statement log_error_verbosity log_statement Are there any entries in the Postgres log that reference this table? > >> > >>> I hope this clears out any confusion. >>> >>> -----Original Message----- >> Adrian Klaver >> adrian.klaver@aklaver.com >> >> Disclaimer > > > Disclaimer -- Adrian Klaver adrian.klaver@aklaver.com