"duplicate key violates unique constraint" error

Started by tamanna madaanover 16 years ago3 messagesgeneral
Jump to latest
#1tamanna madaan
tamanna.madan@globallogic.com

Hi All

I have a cluster setup with one master and one slave . Replication from
master to slave is not taking place.

I am getting this error "duplicate key violates unique constraint" in
my slon.log on slave . This error is thrown while

Slon is inserting a row in a table on slave. This must be because of
the reason that duplicate rows

are being returned while querying sl_log_1 table. I googled about the
same problem and found that

there is some bug in postgres due to which some table or index on that
table gets corrupted. Due to this

duplicate rows are either stored in the table or there are no duplicate
rows but

duplicates are returned while querying the table.

I am using postgres 8.1.2 and slony 1.1.5 .

Please suggest which version of postgres has fix for above mentioned
problem.

Thanks...

Tamanna

#2Richard Huxton
dev@archonet.com
In reply to: tamanna madaan (#1)
Re: "duplicate key violates unique constraint" error

tamanna madaan wrote:

I am getting this error "duplicate key violates unique constraint" in
my slon.log on slave . This error is thrown while

Slon is inserting a row in a table on slave. This must be because of
the reason that duplicate rows

are being returned while querying sl_log_1 table.

And are there any errors in the PostgreSQL logs? Does this table contain
duplicates?

I googled about the
same problem and found that

there is some bug in postgres due to which some table or index on that
table gets corrupted. Due to this

What bug? Do you have a number or mailing-list reference?

I am using postgres 8.1.2 and slony 1.1.5 .

Please suggest which version of postgres has fix for above mentioned
problem.

I'm not sure it's clear what problem we're talking about here.

However, you are missing *16* updates for PostgreSQL (8.1.18) and four
for slony (1.1.9).

First step - get a fresh cup of tea or coffee, read through the release
notes between 8.1.2 and 8.1.18 and once you are happy upgrade. Do the
same for slony.

Then, if the slony sl_log table(s) have errors, I'd probably restart the
whole replication from scratch. I'd never be happy that I'd found all
the problems and corrected them.

If you are starting the replication from base, it might make sense to
upgrade slony to 1.2.17 while you're doing so.

HTH

--
Richard Huxton
Archonet Ltd

#3Scott Marlowe
scott.marlowe@gmail.com
In reply to: tamanna madaan (#1)
Re: "duplicate key violates unique constraint" error

On Wed, Nov 11, 2009 at 10:12 PM, tamanna madaan
<tamanna.madan@globallogic.com> wrote:

 Hi All

I have a cluster setup with one master and one slave . Replication from
master to slave is not taking place.

I am getting this error  “duplicate key violates unique constraint”  in my
slon.log on slave . This error is thrown while

Slon is inserting a row in a table  on slave. This must be because of the
reason that duplicate rows

are being returned while querying sl_log_1 table.  I googled about the same
problem and found that

there is some bug in postgres due to which some table or index on that table
gets corrupted. Due to this

If your underlying file system is unreliable and results in a
corrupted index that allows postgresql to insert duplicate rows, that
is NOT a bug in postgresql, it is a failing in your hardware / OS that
you need to get fixed. Pgsql can't be blamed for errors created by
bad hardware, and no amount of coding can overcome that deficit.