Re: "long" type is not appropriate for counting tuples

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "long" type is not appropriate for counting tuples
Дата
Msg-id 10152.1556493899@sss.pgh.pa.us
обсуждение исходный текст
Ответ на "long" type is not appropriate for counting tuples  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: "long" type is not appropriate for counting tuples  (Peter Geoghegan <pg@bowt.ie>)
Re: "long" type is not appropriate for counting tuples  (Andres Freund <andres@anarazel.de>)
Список 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 по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: "long" type is not appropriate for counting tuples
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: "long" type is not appropriate for counting tuples