pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Mik Rose <mrose@power-soft.com>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: (pgsql8.4) DATA Corruption
Date: Fri, 26 Aug 2011 11:51:36 +0800
Message-ID: <4E571848.9010504@ringerc.id.au> (raw)
In-Reply-To: <0F87A7E6-6BF1-43BF-9299-BD94E28547FB@power-soft.com>
References: <F9528C0916A72145B548F5A758993ACC0EEFB41A@powerexchange.power-soft.net>
	<CAOR=d=05dcTFyV2zv1hPjUu4iTXT1w+sTySErF-PrmmB9jT=9g@mail.gmail.com>
	<0F87A7E6-6BF1-43BF-9299-BD94E28547FB@power-soft.com>

On 20/08/2011 4:27 AM, Mik Rose wrote:
> Thanks for the suggestions Scott.
>
> I was looking at the zero_damage_page option and enabled it in my 
> postgres.conf.  I saw that it detected bad pages and zero'd them out 
> during a number of reindex and a vacuum's.
>
> Now when i reindex though,  I am getting this error.
>
> NOTICE:  table "pg_foreign_server" was reindexedERROR:  could not 
> create unique index "pg_toast_57366_index"
> DETAIL:  Table contains duplicated values.
>
> ERROR:  could not create unique index "pg_toast_57366_index"
> DETAIL:  Table contains duplicated values.

You'll have to figure out what what values are duplicates within each 
table and DELETE one of them after determining which is the correct one 
- if you can. Then you should be able to re-create the index. If the 
DELETE fails you might find you have to DROP the index, do the 
DELETE(s), then CREATE the index again.

If the index is a partial index (ie it has a WHERE clause) you need to 
find duplicates that match that WHERE clause, you can ignore ones that 
don't match.

I hope you took a file-system-level backup of your database before 
starting to mess with it. People here will normally advise you to do 
that first and I'm kind of surprised nobody did.

--
Craig Ringer

view thread (4+ messages)

Message-ID: <4E571848.9010504@ringerc.id.au>
Permalink:  ../4E571848.9010504@ringerc.id.au/
Also on:    postgresql.org/message-id/4E571848.9010504@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ringerc@ringerc.id.au, mrose@power-soft.com, scott.marlowe@gmail.com
  Subject: Re: (pgsql8.4) DATA Corruption
  In-Reply-To: <4E571848.9010504@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox