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

From Peter Eisentraut
Subject Re: "long" type is not appropriate for counting tuples
Date
Msg-id 5bd0e87a-3467-1851-8c60-bfe7a681ab7d@2ndquadrant.com
Whole thread Raw
In response to Re: "long" type is not appropriate for counting tuples  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: "long" type is not appropriate for counting tuples
List pgsql-hackers
On 2019-05-22 21:21, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> Could we define int64 to be long long int on all platforms and just
>> always use %lld?
> 
> Hmmm ... maybe.  Once upon a time we had to cope with compilers
> that didn't have "long long", but perhaps that time is past.

It's required by C99, and the configure test for C99 checks it.

> Another conceivable hazard is somebody deciding that the world
> needs a platform where "long long" is 128 bits.  I don't know
> how likely that is to happen.

Another option is that in cases where it doesn't affect storage layouts,
like the counting tuples case that started this thread, code could just
use long long int directly instead of int64.  Then if someone wants to
make it 128 bits or 96 bits or whatever it would not be a problem.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Julian Schauder
Date:
Subject: Re: Excessive memory usage in multi-statement queries w/partitioning
Next
From: David Rowley
Date:
Subject: Re: Excessive memory usage in multi-statement queries w/ partitioning