Thread: BUG #9895: Duplicate pkey

BUG #9895: Duplicate pkey

From
nk.schjoedt@gmail.com
Date:
The following bug has been logged on the website:

Bug reference:      9895
Logged by:          Niels Kristian
Email address:      nk.schjoedt@gmail.com
PostgreSQL version: 9.3.4
Operating system:   Ubuntu
Description:

Hi I just realized that my data contains a few duplicate primary keys! There
has ALWAYS been a PRIMARY KEY constraint on those ID's. The affected records
might have been created while running a previous version of postgresql.

Re: BUG #9895: Duplicate pkey

From
Michael Paquier
Date:
On Mon, Apr 7, 2014 at 8:57 PM,  <nk.schjoedt@gmail.com> wrote:
> Hi I just realized that my data contains a few duplicate primary keys! There
> has ALWAYS been a PRIMARY KEY constraint on those ID's. The affected records
> might have been created while running a previous version of postgresql.

9.3.4 has fixed a data corruption issue in WAL replay that could
create inconsistent query results when using an index on a standby.
This could lead to violations of primary keys for example. Perhaps you
have been bitten by that:
http://www.postgresql.org/docs/devel/static/release-9-3-4.html
When updating to 9.3.4 it is recommended to replace all the standbys
by a new base backup after the update.
Regards,
--
Michael

Re: BUG #9895: Duplicate pkey

From
Niels Kristian Schjødt
Date:
Thanks, that is most defiantly the case.

What is the best approach on doing a loop of re-checking of all my constraints (pkeys, fkeys) -> fixing issues ->
checkingagain, to make sure that my data is OK? 

Den 08/04/2014 kl. 02.22 skrev Michael Paquier <michael.paquier@gmail.com>:

> On Mon, Apr 7, 2014 at 8:57 PM,  <nk.schjoedt@gmail.com> wrote:
>> Hi I just realized that my data contains a few duplicate primary keys! There
>> has ALWAYS been a PRIMARY KEY constraint on those ID's. The affected records
>> might have been created while running a previous version of postgresql.
>
> 9.3.4 has fixed a data corruption issue in WAL replay that could
> create inconsistent query results when using an index on a standby.
> This could lead to violations of primary keys for example. Perhaps you
> have been bitten by that:
> http://www.postgresql.org/docs/devel/static/release-9-3-4.html
> When updating to 9.3.4 it is recommended to replace all the standbys
> by a new base backup after the update.
> Regards,
> --
> Michael