From: Rainer Pruy <Rainer.Pruy@Acrys.COM>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: PG8.4.7: updating rows leaves duplicate rows violating PK
Date: Wed, 17 Aug 2011 14:05:36 +0200
Message-ID: <4E4BAE90.9080309@acrys.com> (raw)
In-Reply-To: <CAFj8pRD1enH13Cerdo=OgNkm-2zxzk_cJYt1DWSPW-+95C96rw@mail.gmail.com>
References: <4E4B960D.3020600@acrys.com>
<CAFj8pRD1enH13Cerdo=OgNkm-2zxzk_cJYt1DWSPW-+95C96rw@mail.gmail.com>
Hallo,
this is strange for sure. The database is in heavy use regularly.
So it is - if at all - a rare occurrence.
The update statement reported 346305 updated rows.
And I could verify that this is the number of rows that hat there value
change
(where afterwards there was a "new" version in the table.
Thus, the update statement actually performed its operation.
After eliminating the "offending" rows the index is operational again
and does not complaining about violations.
Thus, it is not likely a plain bad PK index.
I already tried to come up with something that could create a false
positive here,
but am out of ideas now.
Up to now this only happened with said table.
May be something is bad with the table?
However, the current instance is nearly a fresh installation of PG
with data loaded from a pg_dumpall from another instance
(for some special testing and analysis).
Thus, I have events with two different instances of PG.
Something being imported by plain DML operations?
A strange idea by itself anyway.....
Still clueless...
Rainer
Am 17.08.2011 13:33, schrieb Pavel Stehule:
> Hello
>
> 2011/8/17 Rainer Pruy <Rainer.Pruy@acrys.com>:
>> This is strange and as of now I do not have a reliable way of reproducing.
>> Nevertheless,
>> either there is a major blunder on my side that urgently needs being
>> pointed at and eliminated
>> or there is something really strange with PG.
>>
>> Short version:
>>
>> I update some rows of a table changing non-primary key column values.
>> Afterwards some of the updated rows are returned from a query with
>> the version from before and after the update.
>>
>> Consequently the PK is detected inconsistent later on and errors are
>> reported accordingly.
>>
>>
> It is strange - are you sure, so UPDATE statement doesn't fail? Are
> you sure, so UPDATE statement really modified rows?
> Are you sure, so you are has not a broken index on PK?
>
> Regards
>
> Pavel Stehule
>
>> Longer Version: please see text attachment
>>
>>
>> server_version | 8.4.7
>> server_version_num | 80407
>>
>> OS: NetBSD 5.99.38
>>
>> Sizes:
>> account_item 12 GB 6,8079,402 rows
>>
>> While the update was executing another process was active that was
>> issuing a sequence of select.
>>
>> Running that very sequence on a copy clone of the database (before the
>> update)
>> worked without such effect.
>>
>> I had 3 similar occurrences before.
>> But those were on a DB instance used for development and I could not
>> verify the primary key was active during update.
>> Here it is verified it was in place. So the "bad" entries probably could
>> have been rejected due to PK violation?
>>
>> Not much input I can give for decent analysis,
>> but either someone can point me to the obvious
>> or it is something thats worth being watched for somehow....
>>
>> Rainer
>>
>>
>>
>>
>> --
>> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-bugs
>>
>>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Rainer.Pruy@Acrys.COM, pavel.stehule@gmail.com
Subject: Re: PG8.4.7: updating rows leaves duplicate rows violating PK
In-Reply-To: <4E4BAE90.9080309@acrys.com>
References: <4E4B960D.3020600@acrys.com> <CAFj8pRD1enH13Cerdo=OgNkm-2zxzk_cJYt1DWSPW-+95C96rw@mail.gmail.com> <4E4BAE90.9080309@acrys.com>
* 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