Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZum7-00036g-SX for pgsql-bugs@arkaria.postgresql.org; Sat, 26 Oct 2013 03:42:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VZum6-0005cn-Bz for pgsql-bugs@arkaria.postgresql.org; Sat, 26 Oct 2013 03:42:54 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZl9t-0008M6-La for pgsql-bugs@postgresql.org; Fri, 25 Oct 2013 17:26:50 +0000 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VZl9p-0006WM-4R for pgsql-bugs@postgresql.org; Fri, 25 Oct 2013 17:26:48 +0000 Received: by mail-pd0-f176.google.com with SMTP id g10so4189472pdj.7 for ; Fri, 25 Oct 2013 10:26:44 -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=nf4T8EhU7T7P0WTk8EMPalEOJg8ieXsG5Tasy0rilas=; b=f3uxQf84mag1xfgMCS7OIYuorYW9AEf5OvBZLt6l4St/tjE9PODOxIiH+j3nHHgLf6 fsYZGtE7cULfww8Fly8d0O6a3g61alBsWagYFTKHW4DrV8zKjPQD4uAhLglYgLoAUpmh dUF5gKzZJdIfkwKIXai+GVCTUScv7nxdY2Oc8= 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=nf4T8EhU7T7P0WTk8EMPalEOJg8ieXsG5Tasy0rilas=; b=fXC4fwFIx0WdEuYmf1r3JyeEtJRPToFe99QZ6eiXQZL1P3iJwTOn7pvLgkOUVVmayB 50/nB8sA4Vnoh24XxZIILIhm7VFXQnNpyRKfFD7YivPhjXdD1qRm4vaDB0Tvkx4InshA k3JDT/mtCDzSxxEqADv+fkDsg2IBBqnSXRGF5W7HLxuyjq3USigauZ1K6y3WqNnwUz4t lcDlZ0te11JJ2rdzbIUZpQ87mh0XPtDbB9HJfl36Dvo7OQ5vn9vM53qoWZB2KDyRof8k pzdbrm98iKJm/yi3kCFt+TkeAolOXitqnd2wyrW1364YR9QItxy7mL7c9Me0RTTZsipe MirA== X-Gm-Message-State: ALoCoQlrYU2xJiZPn0B62asbd1dw+MXm+yzRe+i+wUTBS2KNecTxMlVU5Uiv+GTJWvM5/oE5mqdT X-Received: by 10.68.201.138 with SMTP id ka10mr2764682pbc.192.1382722003990; Fri, 25 Oct 2013 10:26:43 -0700 (PDT) Received: from [192.168.15.220] ([207.178.236.154]) by mx.google.com with ESMTPSA id ja5sm10839754pbc.14.2013.10.25.10.26.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Oct 2013 10:26:43 -0700 (PDT) Message-ID: <526AA998.8000401@mvscusa.com> Date: Fri, 25 Oct 2013 10:25:44 -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/mixed; boundary="------------030000080603070503060800" 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. --------------030000080603070503060800 Content-Type: multipart/alternative; boundary="------------040006090902030200050604" --------------040006090902030200050604 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Additional information on the issue - 'Equal' and 'between' operators return different results, see below. >psql -h pgsqltest -U billing -d billing billing=# select jobid, name from job where jobid = 2; jobid | name -------+------------------- 2 | Payment Processor (1 row) billing=# select jobid, name from job where jobid between 2 and 2; jobid | name -------+------------------- 2 | Payment Processor 2 | Payment Processor 2 | Payment Processor (3 rows) Dump file also contains duplicates, see attached file. >pg_dump.exe --host pgsqltest ... --format plain --file "job-plain.backup" --table "public.job" "billing" 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 > --------------040006090902030200050604 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Additional information on the issue - 'Equal' and 'between' operators return different results, see below.

>psql -h pgsqltest -U billing -d billing

billing=# select jobid, name from job where jobid = 2;
 jobid |       name
-------+-------------------
     2 | Payment Processor
(1 row)


billing=# select jobid, name from job where jobid between 2 and 2;
 jobid |       name
-------+-------------------
     2 | Payment Processor
     2 | Payment Processor
     2 | Payment Processor
(3 rows)

Dump file also contains duplicates, see attached file.

>pg_dump.exe --host pgsqltest ...  --format plain --file "job-plain.backup" --table "public.job" "billing"

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

--------------040006090902030200050604-- --------------030000080603070503060800 Content-Type: text/plain; charset=windows-1252; name="job-plain.backup" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="job-plain.backup" LS0KLS0gUG9zdGdyZVNRTCBkYXRhYmFzZSBkdW1wCi0tCgotLSBEdW1wZWQg ZnJvbSBkYXRhYmFzZSB2ZXJzaW9uIDkuMy4xCi0tIER1bXBlZCBieSBwZ19k dW1wIHZlcnNpb24gOS4zLjAKLS0gU3RhcnRlZCBvbiAyMDEzLTEwLTI1IDE2 OjAxOjE2CgpTRVQgc3RhdGVtZW50X3RpbWVvdXQgPSAwOwpTRVQgbG9ja190 aW1lb3V0ID0gMDsKU0VUIGNsaWVudF9lbmNvZGluZyA9ICdVVEY4JzsKU0VU IHN0YW5kYXJkX2NvbmZvcm1pbmdfc3RyaW5ncyA9IG9uOwpTRVQgY2hlY2tf ZnVuY3Rpb25fYm9kaWVzID0gZmFsc2U7ClNFVCBjbGllbnRfbWluX21lc3Nh Z2VzID0gd2FybmluZzsKClNFVCBzZWFyY2hfcGF0aCA9IHB1YmxpYywgcGdf Y2F0YWxvZzsKClNFVCBkZWZhdWx0X3RhYmxlc3BhY2UgPSAnJzsKClNFVCBk ZWZhdWx0X3dpdGhfb2lkcyA9IGZhbHNlOwoKLS0KLS0gVE9DIGVudHJ5IDIx NSAoY2xhc3MgMTI1OSBPSUQgMzU5MjMzKQotLSBOYW1lOiBqb2I7IFR5cGU6 IFRBQkxFOyBTY2hlbWE6IHB1YmxpYzsgT3duZXI6IHBvc3RncmVzOyBUYWJs ZXNwYWNlOiAKLS0KCkNSRUFURSBUQUJMRSBqb2IgKAogICAgam9iaWQgaW50 ZWdlciBERUZBVUxUIG5leHR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CjQJRGFzaGJvYXJkIFVwZGF0ZXIJRGFzaGJvYXJkVXBk YXRlckpvYgkzNjAwCXQJMjAxMy0xMC0xOSAwMjowMzo0NS45NDcJZgkxMjcJ XE4JXE4JZgpcLgoKCi0tCi0tIFRPQyBlbnRyeSAzMjUxIChjbGFzcyAyNjA2 IE9JRCAzNTkyMzgpCi0tIE5hbWU6IHBrX2pvYjsgVHlwZTogQ09OU1RSQUlO VDsgU2NoZW1hOiBwdWJsaWM7IE93bmVyOiBwb3N0Z3JlczsgVGFibGVzcGFj ZTogCi0tCgpBTFRFUiBUQUJMRSBPTkxZIGpvYgogICAgQUREIENPTlNUUkFJ TlQgcGtfam9iIFBSSU1BUlkgS0VZIChqb2JpZCk7CgoKLS0gQ29tcGxldGVk IG9uIDIwMTMtMTAtMjUgMTY6MDE6NDIKCi0tCi0tIFBvc3RncmVTUUwgZGF0 YWJhc2UgZHVtcCBjb21wbGV0ZQotLQoK --------------030000080603070503060800 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------030000080603070503060800--