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 1vq6Av-004aYi-0K for pgsql-general@arkaria.postgresql.org; Wed, 11 Feb 2026 09:06:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vq69v-0032pY-16 for pgsql-general@arkaria.postgresql.org; Wed, 11 Feb 2026 09:05:20 +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 1vq69u-0032p3-2d for pgsql-general@lists.postgresql.org; Wed, 11 Feb 2026 09:05:19 +0000 Received: from mail80.mailinfra.com ([193.245.87.146]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vq69r-000000007fN-1Ei9 for pgsql-general@lists.postgresql.org; Wed, 11 Feb 2026 09:05:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kbc.be; s=selector-bbb; t=1770800715; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version:content-transfer-encoding; bh=gxOGjm6vBc0E1ZYMfmNq5t/ZHVcrUoPLoJj0mkXFGxE=; b=K8jwOWKMkQARCOHiIKQwc4cfBNFbbqtYFE4rLzgZ4r7UDftTDtjTp/Qw 7pCPt52GI97UQsV5Q7jrcKrGdOjkyiuWy3TgEy03xfgSktBKxcK0v+TmK JO25Lu6yiDhg8tE+tTvfDLh/wmshy7xiuJZZ4wCuJUnoaSiB7JRL0V27a 4fzKSMxBY/ULYdoB+v76mzS7pxK7VL1nW1Bp0Mbz9mCQ1QEceC8LR72Ad 0SEz6iRj9Kq0D+Ta8U1U9Se5guF/Ah0MYFyaKnVkU1skoFlxaY2Oz3Qjx 1Z1eAjFfwWp0/RJ2JW5HKzOwBcy+7CwQ+q/NL1z/XJuZeJAjSyhCI4z9s w==; X-CSE-ConnectionGUID: 6XKKxH3xRi2nhzfKrL2AhA== X-CSE-MsgGUID: jKTzYE83R1qy0KJUA4mVTQ== X-interpillar: False X-massmail: False X-trusted-saas: False Received: from mail113.mailinfra.com ([193.244.104.21]) by mail72.mailinfra.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2026 10:05:11 +0100 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010060.outbound.protection.outlook.com [52.101.84.60]) by mail113.mailinfra.com (Postfix) with ESMTPS id 8120F600092; Wed, 11 Feb 2026 10:05:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xOJeYjO8B55LCAuu53wFw56p36s9jpXaMDiCpJj99nmj6x3tOn2DVkWasMek/I2XmeNoFqZ35cX5lp8aKfRe2YI+7mJfQRrAFCuxsqHTY5bYzK2fZqZ367QJEgBoENbUYhg1tivoj27Z5WZGg7kNbaC0npW06y+dTaoyX8eRuLxWGTtbMuRTco8Uc1XjxQdY6B7PXkZgnAeDZPAs6bCHT+1a1VkIQwU96zK+UnGyydEVC8y/M8huyeoX053GLccmGN0Fq14ITj5s9fA8nnzj6rQaEttEveX6sJ6raCw/u3X3ucr/Jd8PE2VFbsfeIBO/NTw9dtG99jjDU0AlvPzqMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fQ1lEMDJCc7ickmKSepjTXg6HXd99G4V7QS90pBuva4=; b=c3co97ff4TZkDigAvuLPBkfuuETjBH1Rr0Dba2TjQA0UnYjxiyUb5fOIg+SqJ2oknm5vRHScpqNHJS5We+VF2ZgAHUvB/x31Y3H4apvkT+Qysc7p+/5fYaGbJOJD2iPR8BDCdrQlnz/fZG1aja5tThqK0zNOnKSbhWMjLJ/U215EkmTzmbyDpAIvTtWi6Mx08oC9oETXSn4k550S8u7e48Y5CkCjLnxt63icuCjh/MOQsc1gyMZTeDhVQJ3yXUEl1nGbETh4wjpM+hn0rncpyA7hGzUbTQrc+rx+B313MDgHiC9lqMtjkEesRF3XEq70w/R+xAFgeeQl/uD6VDeN9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kbc.be; dmarc=pass action=none header.from=kbc.be; dkim=pass header.d=kbc.be; arc=none Received: from AS2PR05MB10754.eurprd05.prod.outlook.com (2603:10a6:20b:64c::7) by PAWPR05MB11010.eurprd05.prod.outlook.com (2603:10a6:102:37f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.19; Wed, 11 Feb 2026 09:05:08 +0000 Received: from AS2PR05MB10754.eurprd05.prod.outlook.com ([fe80::d189:6660:2fdc:d9a4]) by AS2PR05MB10754.eurprd05.prod.outlook.com ([fe80::d189:6660:2fdc:d9a4%5]) with mapi id 15.20.9587.017; Wed, 11 Feb 2026 09:05:08 +0000 From: Wim Rouquart To: Adrian Klaver , Greg Sabino Mullane CC: "pgsql-general@lists.postgresql.org" Subject: RE: Index (primary key) corrupt? Thread-Topic: Index (primary key) corrupt? Thread-Index: Adwol1a+rcvHuOuQQceM5FEl8oW9YQAHiEkAACShEdAAB3jzAAAAjjoABGxqcgADNfAWkAALH2WAEdn63xAACBjIgAAnIcgwAAutSwAAITAcAA== Date: Wed, 11 Feb 2026 09:05:08 +0000 Message-ID: References: <1bfa0b6b-11a8-458f-a3f3-3f86574abc1d@aklaver.com> <5043ff13-2f39-4a80-a8f8-6765746b6a89@aklaver.com> <58221272-d684-4799-a113-d5a5031a0b05@aklaver.com> In-Reply-To: <58221272-d684-4799-a113-d5a5031a0b05@aklaver.com> Accept-Language: nl-BE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_d44a7eb9-e308-4cb8-ad88-b50d70445f3a_Enabled=True;MSIP_Label_d44a7eb9-e308-4cb8-ad88-b50d70445f3a_SiteId=64af2aee-7d6c-49ac-a409-192d3fee73b8;MSIP_Label_d44a7eb9-e308-4cb8-ad88-b50d70445f3a_SetDate=2026-01-29T08:07:22.0000000Z;MSIP_Label_d44a7eb9-e308-4cb8-ad88-b50d70445f3a_Name=d44a7eb9-e308-4cb8-ad88-b50d70445f3a;MSIP_Label_d44a7eb9-e308-4cb8-ad88-b50d70445f3a_ContentBits=3;MSIP_Label_d44a7eb9-e308-4cb8-ad88-b50d70445f3a_Method=Standard authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kbc.be; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AS2PR05MB10754:EE_|PAWPR05MB11010:EE_ x-ms-office365-filtering-correlation-id: 1d4f2809-4aec-4ad7-249c-08de694ca7d4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|19092799006|366016|1800799024|7053199007|38070700021; x-microsoft-antispam-message-info: =?us-ascii?Q?jeI16+cB0ezwf5ebxIwXhh+c3LB4zz4fIZeu27V756oezm4hwWTB7KQc6u2w?= =?us-ascii?Q?qZZA2WV3KVvtuhwLwBlRtDjOdANhhrKqhUDEtdYA47PMaIPN2K+fn/jIUISh?= =?us-ascii?Q?NSPV0h/HiKA8iFZ4UZRzcclxHXk9jYq8sJA74wsSon79m2Qak40Ok4cs5YiC?= =?us-ascii?Q?sGwTa+3/w8aMIRd4PPYBPeeqvkGiyQPT/pX1KJPJYzmuf0efpPoxc1LgPIiW?= =?us-ascii?Q?avRLR//BLTIYX6eusmX1hVXomF81q6PIA3qIAEa74HQrF2KA+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9Tfz5WbgjGBIGeYmDn9OmVOthnhNRDgx5xUVM5yYa4?= =?us-ascii?Q?pHQUTrkwcB4ONtkwo8FOAJJ5xJy4n4Gi7X6tb1x+iMiFC2lL1onTwXaXvoV+?= =?us-ascii?Q?XojIwadq/vQIMrFRuOWZWJSrPtDC7ge7c0eCz+pVk7dIXI6CKZuuowRRe2bh?= =?us-ascii?Q?OpSF8UXdXOGCSPodMrJ6b9SBBIdtb6UWsVw2MInwusvbrkYcgJvy5DaS9Hx7?= =?us-ascii?Q?w7NwvDaE8Fj9NX4HE3UUesHFbFIHiFBl8U93CZutmGhCr0VDGNukyQWUdeky?= =?us-ascii?Q?dXXcxoQCFclQRMmFJsEofqgskFTu5VM6/KXrE/48jl5j2eraL3sBqins61np?= =?us-ascii?Q?Z2Qs4r1qJFFgxJNys4OxiZSsNccdlQDnzsr2myRlUvMPWB/fHtb1o0Xom5N/?= =?us-ascii?Q?Nmaj7Tw+RZ8pC+hzxqFSaoGERQVa5F1+5SRwBoqahPNbfSsSHpeNd2/+j8Rs?= =?us-ascii?Q?uly7zIMkpb0/qiB6H0jDAiA=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS2PR05MB10754.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(19092799006)(366016)(1800799024)(7053199007)(38070700021);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?fKpsV3DZszwzMhAW8ORMBBK+P0VpM/djf24weEInecRJkC0ZjfjdLA21Vi2i?= =?us-ascii?Q?TRB6sM6ShC4if/rY1vHbWOtPHykgw0yRJ19ePNqQ1fUnen19RSzv5/z4MYkF?= =?us-ascii?Q?1VYvMgOUgSMd4AdCj+KcPRDtDW3zcZ0JFirb5+cb2lKhyiw+IyYK5boRZecm?= =?us-ascii?Q?lRQVBOSvXhjTMpJFnx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?Q?M0qoH3ys9dIYEWlhxEjZrtw1ZLE80HFs1Ytx0fSGGA/cRC9oSdH+opKRNrfr?= =?us-ascii?Q?fzTjw2WhjF+lu+goP8jbz+kelJrJGFzyDGeVLc4YWqu7jt7j62b59MIm/vVF?= =?us-ascii?Q?VxixpMBqFFu4A0CaU3XKGhgK8FCXfVM5VvaGiwInzNQwKEv2DxWLzv70tyFt?= =?us-ascii?Q?fItFUrtbSIuyiNgpUW5w0lPdRs9Cx8ZVDqa/zp1ASV76tak/G87+Kp/yEoBS?= =?us-ascii?Q?54H9WSYfAvZ9czM7fU4Qh5WFq1zmjF0Q0WKlm0y7YjLgnEB02CVNY/kTq2Fq?= =?us-ascii?Q?6SmaJTGl9Q59bMIjlctLrzrR+h9MEh3ixY3S3i07DAkHhfluFOVkwIKVeiCy?= =?us-ascii?Q?fbkZQ6hNY6PfFoCDCMIpKTYh8FEfpkEEVytWtH2wSgWtnNu19oxJxNMSiv8B?= =?us-ascii?Q?L1yQy6YxO1rE1TKdbuGLx+HB+KrOL6W6yo9r2UywyG4ycWccIvcE2dzltEL1?= =?us-ascii?Q?eBGzV8eDHJ52i5ThwLuv34r248lMBc8mkEYhUrtFbnK/4o0eLW2b3+kJbobJ?= =?us-ascii?Q?loeiO+wg5HSF3dofHYthhF98GiGNFaTYS/SI7EdPBFsMVk0wXl13JDl88kLz?= =?us-ascii?Q?lTiKN4lG3AGpyoeZ7wOOuegdp9yARSZBiqbnIXI4HIyA/OESocJut5BJ2VZO?= =?us-ascii?Q?TFmMR7d5eQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: kbc.be X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS2PR05MB10754.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d4f2809-4aec-4ad7-249c-08de694ca7d4 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2026 09:05:08.6949 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 64af2aee-7d6c-49ac-a409-192d3fee73b8 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YU/fN6HVLBNUQEBhCfyWkCQayyz7OxhsSxS1LW0Yi5xAJ7TEPjb07LMYT03uVOYtonkjxTIVLcvYjFYTDUhn2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR05MB11010 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Internal I know the initial thread was started a while ago, but as was explained the= re the restore was done purely to have a playground db for this specific is= sue. I know the difference between pg_dump and pg_restore. The issue is with pg_dump, not with pg_basebackup (as is proven as pg_baseb= ackup and then the restore perfectly transfers the 'situation' as is betwee= n the production database and the playground database). I just did the dumps as requested, neither of them are showing the index cr= eate as expected. -----Original Message----- From: Adrian Klaver Sent: woensdag 28 januari 2026 17:17 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 1/28/26 03:02, Wim Rouquart wrote: > Internal > > Bottom line the index exists, it is just not being applied. > > -> It seems to exist indeed, but not visible for pg_dump and some other c= atalog queries... > > Questions: > > 1) What is the restore command being used? > > -> It's just an untar of the full backup created with pg_basebackup. No n= eed to focus on this imo, the restore was done from the production db so I = could have a playground for this situation. It's clear the situation is the= same on the original and the backup copy. Whoa, pg_basebackup does not involve pg_dump. They are two different beasts= , where pg_basebackup is a file based binary method and pg_dump/pg_restore = is a logical method of issuing commands. So the restore method is definitel= y something that needs to be looked at. Even if in the production scenario = pg_basebackup is not being used how the schema and data are being restored = is important as that seems to be the step where information goes missing. > -> Well, we export the database using pg_dump, and on import some foreign= key indexes which reference the problem primary key index fail to create b= ecause it's not created, which makes sense. It's not created because it's n= ot exported. If you are using pg_dump on one end of the process and pg_basebackup on the= other end I can see where there are issues, though I would expect more pro= blems. In a pg_dump/pg_restore cycle I don't know how a user created index could b= e present in the system catalog without also being present in the pg_dump c= ommands or throwing some sort of error. > > 4) What happens if you create a test database and restore bcf_work_type b= y itself, with and without data? > > -> I could test this, how would you suggest to do the backup/restore part= , also pg_dump? For table w/data: pg_dump -d some_db -U some_user -t name_hidden.bcf_work_type -f bcf_work_ty= pe.sql with table schema only: pg_dump -d some_db -U some_user -s -t name_hidden.bcf_work_type -f bcf_work= _type.sql This will produce a plain text SQL script. To restore: psql -d some_other_db -U some_user -f bcf_work_type.sql -- Adrian Klaver adrian.klaver@aklaver.com Disclaimer