Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZoeF-00049C-4t for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Oct 2013 21:10:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VZoeD-0008Th-Al for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Oct 2013 21:10:21 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZl3i-00074X-HH for pgsql-bugs@postgresql.org; Fri, 25 Oct 2013 17:20:26 +0000 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZl3d-0006N3-Rg for pgsql-bugs@postgresql.org; Fri, 25 Oct 2013 17:20:25 +0000 Received: by mail-pd0-f175.google.com with SMTP id g10so4225818pdj.6 for ; Fri, 25 Oct 2013 10:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvscusa.com; s=google; h=message-id:date:from:organization:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type; bh=/xe8t6gKaHrIiZoPYDlUvpsk8z1ZNZxuvHOFYJ/UYYE=; b=fa5KbebVkbGCtA6znzBdRY6PzPrKLhWROAOSJmiPNDAeejtZmf4s/Nz653ser2YIpb xnN7oRIkmvJsAELC5VR6OpBoZ3wwP5iPmMzgsmYrHsq8SaykRinBpNpj6GYoSskbNodW AAApT1tdK/A3CqleaoVce1q2jN5ShsT887t1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type; bh=/xe8t6gKaHrIiZoPYDlUvpsk8z1ZNZxuvHOFYJ/UYYE=; b=ObjxqIM1Z3/8b3NoE+75fQSXl18ZUQe/rBLCQ+2wSEqnvM3ejFWhI4KrBDCQgwHp6Y iPlaLeTwUVCnXLfv0EZPv9xQJUuP/LhJ43FArlY4iHzFIFOhkToJJiRIXQ6/Ph5VP4fB 8HWCrpsjH0hBhjuEZtvcyzLHj6xjhS9o11JAJt1rmVbBW9LVXCNYSSOsZCdJd0v3SmfE OatAtmbavU4ydWyD5vexsbCedVUmZtviHWYW3ycx1ETEJ8rTqh5Y4dGfZYL+ZPNotiWW wQmbHOrOIGZ0PMi//9f8/+Vkf4QI1TEjTukB+I7bdi/zV28Z3XE+Q7wE4JBoZ73Wb2MG lLGw== X-Gm-Message-State: ALoCoQmFH0oh/59eKCu3c9SfCDZwXkQvEZuMY5tPVrCh5NPZXrqKz2r/cJKAqbnXzdVdoYo4Z15i X-Received: by 10.68.125.226 with SMTP id mt2mr2778577pbb.115.1382721620226; Fri, 25 Oct 2013 10:20:20 -0700 (PDT) Received: from [192.168.15.220] ([207.178.236.154]) by mx.google.com with ESMTPSA id fe5sm10764953pbc.32.2013.10.25.10.20.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Oct 2013 10:20:19 -0700 (PDT) Message-ID: <526AA818.5030505@mvscusa.com> Date: Fri, 25 Oct 2013 10:19:20 -0700 From: Vadim Yevsyukov Organization: Motor Vehicle Software Corporation User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Pavel Stehule CC: pgsql-bugs@postgresql.org Subject: Re: BUG #8553: CRITICAL - delete from doesn't delete rows, select returns them anyway References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------070305080805060207070709" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------070305080805060207070709 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit REINDEX cannot be done. Getting "ERROR: could not create unique index "pk_job" DETAIL: Key (jobid)=(2) is duplicated". And as I mentioned earlier - I cannot delete these rows as well. Vadim Yevsyukov Motor Vehicle Software Corporation http://www.mvscusa.com On 10/25/2013 7:14 AM, Pavel Stehule wrote: > > It looks like broken index. I dont know what is reason of this error, > but REINDEX should helps. > > Dne 25.10.2013 16:03 > > napsal(a): > > The following bug has been logged on the website: > > Bug reference: 8553 > Logged by: Vadim Yevsyukov > Email address: vadim@mvscusa.com > PostgreSQL version: 9.3.1 > Operating system: CentOS 6.4 > Description: > > After upgrading to PostgreSQL 9.3.1. > > > Schema: > > > create sequence JobSeq start 1; > create table Job > ( > jobId int not null default nextval('JobSeq'), > name varchar(50) not null, > className varchar(50) not null, > timeoutSeconds int null, > enabled boolean not null, > nextRun timestamp null, > running boolean not null, > dayMask int null, > timeOfDaySeconds int null, > dayOfMonth int null, > nextRunForce boolean not null, > constraint PK_Job primary key (jobId) > ); > > > I noticed a weird exceptions in my billing system that's processing > payments. After some research, I found that my internal job > scheduler's > table in PostgreSQL has two records for 'Payment Processor' job > (jobId = 2), > which should not be possible, since jobId is the primary key. > > > I tried to delete records: delete from Job where jobId = 2; But > instead of > reporting '2 records affected', PostgreSQL has reported 'one record > affected'. I ran 'select from Job where jobId = 2' and it returned > no rows, > however when I ran query without 'where' clause 'select * from > Job' - it did > returned two records with jobId = 2. > > > Query 'select count(*) from Job where jobId = 2' also reporting 0, > despite > two records returned in 'select * from Job'. > > > Does look like a CRITICAL bug to me. Let me know please if additional > information is needed. > > > Thank you, > Vadim > > > > -- > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org > ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs > --------------070305080805060207070709 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
REINDEX cannot be done. Getting "ERROR:  could not create unique index "pk_job" DETAIL:  Key (jobid)=(2) is duplicated". And as I mentioned earlier - I cannot delete these rows as well.

Vadim Yevsyukov
Motor Vehicle Software Corporation
http://www.mvscusa.com
On 10/25/2013 7:14 AM, Pavel Stehule wrote:

It looks like broken index. I dont know what is reason of this error, but REINDEX should helps.

Dne 25.10.2013 16:03 <vadim@mvscusa.com> napsal(a):
The following bug has been logged on the website:

Bug reference:      8553
Logged by:          Vadim Yevsyukov
Email address:      vadim@mvscusa.com
PostgreSQL version: 9.3.1
Operating system:   CentOS 6.4
Description:

After upgrading to PostgreSQL 9.3.1.


Schema:


create sequence JobSeq start 1;
create table Job
(
        jobId int not null default nextval('JobSeq'),
        name varchar(50) not null,
        className varchar(50) not null,
        timeoutSeconds int null,
        enabled boolean not null,
        nextRun timestamp null,
        running boolean not null,
        dayMask int null,
        timeOfDaySeconds int null,
        dayOfMonth int null,
        nextRunForce boolean not null,
        constraint PK_Job primary key (jobId)
);


I noticed a weird exceptions in my billing system that's processing
payments. After some research, I found that my internal job scheduler's
table in PostgreSQL has two records for 'Payment Processor' job (jobId = 2),
which should not be possible, since jobId is the primary key.


I tried to delete records: delete from Job where jobId = 2; But instead of
reporting '2 records affected', PostgreSQL has reported 'one record
affected'. I ran 'select from Job where jobId = 2' and it returned no rows,
however when I ran query without 'where' clause 'select * from Job' - it did
returned two records with jobId = 2.


Query 'select count(*) from Job where jobId = 2' also reporting 0, despite
two records returned in 'select * from Job'.


Does look like a CRITICAL bug to me. Let me know please if additional
information is needed.


Thank you,
Vadim



--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

--------------070305080805060207070709--