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

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: "long" type is not appropriate for counting tuples
Дата
Msg-id CA+TgmobQrhsHFCkCH4kZsEsdXhb+x52xy3Q8HKnsq2QpUcZbUw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: "long" type is not appropriate for counting tuples  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On Thu, May 23, 2019 at 10:21 AM Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> Hmm, by that argument, we shouldn't ever use any integer type other than
> int16, int32, and int64.

I think we basically shouldn't.  I mean it's fine to use 'int' as a
flags argument as part of an internal API, or as a loop counter
private to a function or something.  But if you are passing around
values that involve on-disk compatibility or wire protocol
compatibility, it's just a recipe for bugs.  If the code has to
sometimes cast a value to some other type, somebody may do it wrong.
If there's a uniform rule that tuple counts are always int64, that's
pretty easy to understand.

In short, when a certain kind of value is widely-used, it should have
a clearly-declared width.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: "long" type is not appropriate for counting tuples
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_checksums has an untranslatable string.