RE: Index (primary key) corrupt? - Mailing list pgsql-general

From Wim Rouquart
Subject RE: Index (primary key) corrupt?
Date
Msg-id AS2PR05MB107546C1B04FC4B3CCF32E60CEF7DA@AS2PR05MB10754.eurprd05.prod.outlook.com
Whole thread Raw
In response to Re: Index (primary key) corrupt?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Index (primary key) corrupt?
List pgsql-general
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
keyswanted 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
arecord 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
actuallygets 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 <adrian.klaver@aklaver.com>
Sent: vrijdag 13 februari 2026 18:33
To: Wim Rouquart <wim.rouquart@kbc.be>; Greg Sabino Mullane <htamfids@gmail.com>
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
notcreated 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
recordwith a duplicate id?
 

>

>> I hope this clears out any confusion.
>>
>> -----Original Message-----
> Adrian Klaver
> adrian.klaver@aklaver.com
>
> Disclaimer <https://www.kbc.com/KBCmailDisclaimer>


Disclaimer <https://www.kbc.com/KBCmailDisclaimer>

pgsql-general by date:

Previous
From: loganathan P
Date:
Subject: Re: PostgreSQL Archive Log Partition Reaching 95% – Need Automated Cleanup
Next
From: Adrian Klaver
Date:
Subject: Re: Index (primary key) corrupt?