RE: Index (primary key) corrupt?

From: Wim Rouquart <wim(dot)rouquart(at)kbc(dot)be>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: Index (primary key) corrupt?
Date: 2025-09-19 09:40:44
Message-ID: AS2PR05MB107548567EEDAAB3AF74A6C59EF11A@AS2PR05MB10754.eurprd05.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Internal

>> Internal
>>
>>
>> Hello,
>>
>>When doing a pg_dump of one of our databases one of the tables primary
>> keys doesn’t get exported. Pg_dump just skips this index, without any
>> warning whatsoever (verbose mode was used to doublecheck).

> What is the complete table definition?

CREATE TABLE bcf_work_type (
id bigserial NOT NULL,
aml_score int8 NOT NULL,
CONSTRAINT idx_376814_primary PRIMARY KEY (id)
);

> What is the complete pg_dump command being given?

pg_dump --verbose -p <xxx> -U <xxx> -d <xxx> > dumpverbose.sql 2> dumpverbose.log

> Is the PK definition in the pg_dump file? For plain text format can you grep/find it?

It is in neither, that’s why I'm sure it doesn't get exported. After a REINDEX statement it is.

>How is the dump file being restored?

As the code to generate the index is not in the dumpfile this seems irrelevant to me.

>>
>> When doing a REINDEX the issue is fixed.
>>
>> As this seems to me to be some form of index corruption, I tried using
>> amcheck (bt_index_check and bt_index_parent_check) to verify for
>> corruption but both resulted with no issues (the index is a btree).
>>
>> I would expect the corruption to show up when using amcheck, am I
>> hitting some kind of bug here?
>>
>> Are there any other ways to doublecheck for corruption (without
>> enabling checksum upfront)?
>>
>> This concerns a PostgreSQL version 15 btw.
>>
>> Thanks!
>>

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mathieu Pellerin 2025-09-19 10:18:51 Client/server certificates verification support on Android platform
Previous Message Wim Rouquart 2025-09-19 09:29:57 RE: Index (primary key) corrupt?