Re: "long" type is not appropriate for counting tuples - Mailing list pgsql-hackers

From Tom Lane
Subject Re: "long" type is not appropriate for counting tuples
Date
Msg-id 10152.1556493899@sss.pgh.pa.us
Whole thread Raw
In response to "long" type is not appropriate for counting tuples  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: "long" type is not appropriate for counting tuples
Re: "long" type is not appropriate for counting tuples
List pgsql-hackers
Peter Geoghegan <pg@bowt.ie> writes:
> Commit ab0dfc961b6 used a "long" variable within _bt_load() to count
> the number of tuples entered into a B-Tree index as it is built. This
> will not work as expected on Windows, even on 64-bit Windows, because
> "long" is only 32-bits wide.

Right.  "long" used to be our convention years ago, but these days
tuple counts should be int64 or perhaps uint64.  See e.g. 23a27b039.

> ISTM that we should try to come up with a way of making code like this
> work, rather than placing the burden on new code to get it right.

Other than "use the right datatype", I'm not sure what we can do?
In the meantime, somebody should fix ab0dfc961b6 ...

> Also, "off_t" is only 32-bits on Windows, which broke parallel CREATE
> INDEX (issued fixed by commit aa551830). I suppose that "off_t" is
> really a variant of the same problem.

Hmm, why is this a problem?  We should only use off_t for actual file
access operations, and we don't use files greater than 1GB.  (There's a
reason for that.)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: "long" type is not appropriate for counting tuples
Next
From: Peter Geoghegan
Date:
Subject: Re: "long" type is not appropriate for counting tuples