Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples - Mailing list pgsql-hackers

From David Rowley
Subject Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples
Date
Msg-id CAKJS1f-4nND6JqmqxrW_NoVtLEGs7pwv381=hK+5knic4ER+CA@mail.gmail.com
Whole thread Raw
In response to Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 23 May 2018 at 09:31, Andres Freund <andres@anarazel.de> wrote:
>> On 23 May 2018 at 03:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> > Hm, so why is the correct rowcount returned --- are we running
>> > a separate counter for that purpose, and if so why?
>>
>> I thought the output I pasted was clearly showing it not to be the
>> same. 4299999999 vs 4300000000.
>>
>> Did I misunderstand you?
>
> Well, the row-returned counter is obviously wide enough, otherwise
> 4299999999 couldn't be returned. Tom's point, as I understood it, is
> that we obviously have one wide enough counter - why can't we reuse that
> for the one you made wider.  And it doesn't seem entirely trivial to do
> so, so your patch is easier.

*moment of realisation*

Oh, this makes sense now.

They can't be the same. One tracks the line number in the COPY FROM
input, the other tracks the number of rows inserted. You'd only have
to add a BEFORE INSERT ROW trigger which blocks some rows to
understand why they need to be separate.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples
Next
From: Tom Lane
Date:
Subject: Re: plperl fails with perl 5.28