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 1vl8ED-007Xc4-06 for pgsql-general@arkaria.postgresql.org; Wed, 28 Jan 2026 16:17:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vl8EC-002Jbi-0M for pgsql-general@arkaria.postgresql.org; Wed, 28 Jan 2026 16:17:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vl8EB-002JbW-0q for pgsql-general@lists.postgresql.org; Wed, 28 Jan 2026 16:17:12 +0000 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vl8E8-002lGp-1v for pgsql-general@lists.postgresql.org; Wed, 28 Jan 2026 16:17:10 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id D6EEE140008D; Wed, 28 Jan 2026 11:17:07 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 28 Jan 2026 11:17:07 -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=fm2; t=1769617027; x=1769703427; bh=7JUX2xLLK6F9PYBpOsoKZuQLZMo4LYsVcPU4Bz90C0A=; b= F0+XASpPZR8NGZaI+yoaoGrUlp1EiJiwYLnzeQP03B7tp+XFsfA/VX0i/FAL07/L 0LH5asJu20e8/MRBO6jlB6NCw8V3QeWYlEwODiglYYergHIniZydEyLaYmHW7Scb RRq/J/WHKZpuMwhGujY6BF7TVPph2bywOtrUq0/6R65pzqzZQLyHVhv/AskNw3f3 hGaFYkGvGuU654NwDI3gem6Ma1F85vsyZLg5bxHl0GiHQETTE8mrlqI1THQiM9ma PdVd1OXd3U618IQEO2Klh3Q+4ubZoFMKcPz2J1TyUGcUb/7IwMST+VJc3/awl5Ex D2PBxZmrXU5OgKIRCZi1tg== 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=fm3; t=1769617027; x= 1769703427; bh=7JUX2xLLK6F9PYBpOsoKZuQLZMo4LYsVcPU4Bz90C0A=; b=K wQA2KdPWw2C5D6dA+MDw/DfvDs5HTf0dQOXOD/RoylWNH8/tRT0BXdCl8Bgh7dH1 bxvqN08YDdWUy8nooKYjxSi8VMuhPpRAkZhQyeBPKz9JkSNQL1ASQT8yN6tir6HI YxERq4rY2JbPqn5hPRBmHhcBFoEY+T5jmIwFaXFAXenikG6oxxQq0sLr/AclIHXm NSmN5IT/aFkEyh4JcNStVlXGSB3cNzxwupnikiftG3T72wV0S08m3jkLx6Ocdoz9 i+1+whefmnCzAQUJ6Osh66lJd2aBq1HOIYYmfu4RkvjfT2jPuKJTNt8H2yeEfRr6 jQr+/kq38lW0WfPWo6epg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduieefjeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhephfeviefhveelffeftdehudekveefhfeftdegieefveet fffgfeehtdfftedutedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgs pghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepfihimhdrrh houhhquhgrrhhtsehksggtrdgsvgdprhgtphhtthhopehhthgrmhhfihgushesghhmrghi lhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpoh hsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jan 2026 11:17:07 -0500 (EST) Message-ID: <58221272-d684-4799-a113-d5a5031a0b05@aklaver.com> Date: Wed, 28 Jan 2026 08:17:06 -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: <1bfa0b6b-11a8-458f-a3f3-3f86574abc1d@aklaver.com> <5043ff13-2f39-4a80-a8f8-6765746b6a89@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 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 catalog queries... > > Questions: > > 1) What is the restore command being used? > > -> It's just an untar of the full backup created with pg_basebackup. No need 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 definitely 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 because it's not created, which makes sense. It's not created because it's not 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 problems. In a pg_dump/pg_restore cycle I don't know how a user created index could be present in the system catalog without also being present in the pg_dump commands or throwing some sort of error. > > 4) What happens if you create a test database and restore bcf_work_type by 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_type.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