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

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: "long" type is not appropriate for counting tuples
Дата
Msg-id 20190429151141.rhbw5eshpolllxr6@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: "long" type is not appropriate for counting tuples  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: "long" type is not appropriate for counting tuples  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-hackers
Hi,

On 2019-04-28 19:24:59 -0400, Tom Lane wrote:
> Peter Geoghegan <pg@bowt.ie> writes:
> > 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 ...

I think we should start by just removing all uses of long. There's
really no excuse for them today, and a lot of them are bugs waiting to
happen.  And then either just add a comment to the coding style, or even
better a small script, to prevent them from being re-used.


> > 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.)

We read from larger files in a few places though. E.g. pg_dump. Most
places really just should use pgoff_t...

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: jsonpath
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Race conditions with checkpointer and shutdown