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

From Andres Freund
Subject Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples
Date
Msg-id 20180522161645.ovmmqou2uloy7jdg@alap3.anarazel.de
Whole thread Raw
In response to Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: COPY FROM WITH HEADER skips a tuple every 4 billion tuples  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2018-05-22 11:55:26 -0400, Tom Lane wrote:
> David Rowley <david.rowley@2ndquadrant.com> writes:
> > while it might not look too scary by itself, it gets a bit more so
> > when you learn that the cur_lineno is only 32 bits wide. This will
> > result in skipping a tuple every time the 32-bit variable wraps back
> > around to 0 again.
> 
> Hm, so why is the correct rowcount returned --- are we running
> a separate counter for that purpose, and if so why?

Yes, it's a local counter in CopyFrom/CopyTo.  It's probably not
entirely trivial to unify the two. The batching etc makes us modify
cur_lineno in a bit weird ways at times.  It's noteworthy that the
comment for cur_lineno says: /* line number for error messages */

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Lenain
Date:
Subject: pgAdmin4 Docker behind load balancer
Next
From: Andrew Dunstan
Date:
Subject: Re: plperl fails with perl 5.28