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 2089.1558540366@sss.pgh.pa.us
Whole thread Raw
In response to Re: "long" type is not appropriate for counting tuples  (Andres Freund <andres@anarazel.de>)
Responses Re: "long" type is not appropriate for counting tuples
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On May 22, 2019 7:39:41 AM PDT, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
>> On 2019-04-29 19:32, Tom Lane wrote:
>>> Another problem is that while "%lu" format specifiers are portable,
>>> INT64_FORMAT is a *big* pain, not least because you can't put it into
>>> translatable strings without causing problems.  To the extent that
>>> we could go over to "%zu" instead, maybe this could be finessed,
>>> but blind "s/long/int64/g" isn't going to be any fun.

>> Since we control our own snprintf now, this could probably be addressed
>> somehow, right?

> z is for size_t though? Not immediately first how It'd help us?

Yeah, z doesn't reliably translate to int64 either, so it's only useful
when the number you're trying to print is a memory object size.

I don't really see how controlling snprintf is enough to get somewhere
on this.  Sure we could invent some new always-64-bit length modifier
and teach snprintf.c about it, but none of the other tools we use
would know about it.  I don't want to give up compiler cross-checking
of printf formats, do you?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Stas Kelvich
Date:
Subject: Re: Read-only access to temp tables for 2PC transactions
Next
From: Fujii Masao
Date:
Subject: Re: VACUUM fails to parse 0 and 1 as boolean value