Re: Insert result does not match record count

From: Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Natalie Wenz <nataliewenz(at)ebureau(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Insert result does not match record count
Date: 2013-07-24 14:04:03
Message-ID: 51EFDED3.6060101@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 07/22/2013 06:20 PM, Jeff Janes wrote:
> On Fri, Jul 19, 2013 at 3:20 PM, Natalie Wenz <nataliewenz(at)ebureau(dot)com> wrote:
>> Hi all,
>>
>> I am moving some data from one table to another in 9.2.4, and keep seeing this strange scenario:
>>
>> insert into newtable select data from oldtable where proc_date >= x and proc_date < y;
>>
>> INSERT 0 78551642
>>
>> select count(*) from newtable where proc_date >= x and proc_date < y;
>> count
>> -----------
>> 4373518938
> It looks to me like the status report is 32 bits and overflowed.
>
> 4,373,518,938 - 2^32 = 78,551,642

Attached is a small patch that should fix the problem.

Vik

Attachment Content-Type Size
completion_tag_64.patch text/x-patch 3.0 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Some Developer 2013-07-24 14:40:12 Re: Why are stored procedures looked on so negatively?
Previous Message Merlin Moncure 2013-07-24 13:58:29 Re: Why are stored procedures looked on so negatively?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-07-24 14:57:14 Re: [bug fix] PITR corrupts the database cluster
Previous Message Andres Freund 2013-07-24 14:01:15 Re: [bug fix] PITR corrupts the database cluster