Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
> On 10/24/15 3:15 PM, Marc Mamin wrote:
> Any suggestions for what to look for next? Is it table corruption?
>> Most likely is the index corrupt, not the table.
>> You should check for further duplicates, fix them and as Adrian writes,
>> build a new index an then drop the corrupt one.
>>
>> I've seen this a few times before, and if I recall well it was always after some plate got full.
>> Is AWS getting out of space:)
> You should report this to the RDS team, because an out of space
> condition shouldn't leave multiple values in the index. I suspect
> they've made a modification somewhere that is causing this. It could be
> a base Postgres bug, but I'd think we'd have caught such a bug by now...
Notable also is that pg_dump invariably reads tables with a plain "COPY foo"
or "SELECT * FROM foo", which should ignore all indexes and just read the
table contents. So I doubt that reindexing will fix anything: you almost
certainly do have duplicate rows in the base table. It's highly likely
that the index is corrupt, which is what would be necessary to get into
such a state ... but you will need to manually remove the dup rows before
rebuilding the unique index will succeed.
regards, tom lane