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

From Adrian Klaver
Subject Re: Index (primary key) corrupt?
Date
Msg-id b1fec029-b8fb-4177-a01a-9457e813ce68@aklaver.com
Whole thread Raw
In response to RE: Index (primary key) corrupt?  (Wim Rouquart <wim.rouquart@kbc.be>)
Responses RE: Index (primary key) corrupt?
List pgsql-general
On 2/13/26 00:08, Wim Rouquart wrote:
> Internal
> 
> Ok, to do a small recap because indeed this thread has been extended for a while now.
> 
> - The issue with the specific index was noted on a production database (after a datarefresh that partly failed
becauseof the missing index).
 
> 
> - To reproduce and experiment with the issue, a pg_basebackup was taken from that prod instance and restored to a
testinstance. Every single test step is executed on this test instance, the prod database is no longer involved,
pg_basebackupis no longer involved, everything is pg_dump based from here on onwards.
 
> 
> - So this means the test pg_dumps where done with the index in a 'non-fuctional state'. As expected, the create
statementof the index does NOT show up in the generated .sql scripts (neither 'loose' nor in the create statement of
thetable).
 

1) It won't be included with the CREATE TABLE statement per:-

https://www.postgresql.org/docs/current/app-pgdump.html

"--section=sectionname

     Only dump the named section. The section name can be pre-data, 
data, or post-data. This option can be specified more than once to 
select multiple sections. The default is to dump all sections.

     The data section contains actual table data, large-object contents, 
sequence values, and statistics for tables, materialized views, and 
foreign tables. Post-data items include definitions of indexes, 
triggers, rules, statistics for indexes, and constraints other than 
validated check and not-null constraints. Pre-data items include all 
other data definition items.
"
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?

Also what error do you get on the source database that tells you the PK 
is not working?




> 
> I hope this clears out any confusion.
> 
> -----Original Message-----
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: pg_restore failed on foreign key constraint
Next
From: Adrian Klaver
Date:
Subject: Re: pg_restore failed on foreign key constraint