Em qui., 11 de jun. de 2020 às 19:54, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
Ranier Vilela <ranier.vf@gmail.com> writes: > elog and errmsg_internal, permits use as proposed by the patch, > does it mean that errmsg, does not allow and does not do the same job as > snprintf?
Yes. errmsg() strings are captured for translation. If they contain platform-dependent substrings, that's a problem, because only one variant will get captured. And INT64_FORMAT is platform-dependent.
We have of late decided that it's safe to use %lld (or %llu) to format int64s everywhere, but you then have to cast the printf argument to match that explicitly. See commit 6a1cd8b92 for precedent.
Hi Tom, thank you for the detailed explanation.
I see commit 6a1cd8b92, and I think which is the same case with basebackup.c (total_checksum_failures),
maxv and minv, are int64 (INT64_FORMAT).
%lld -> (long long int) maxv
%lld -> (long long int) minv
Attached new patch, with fixes from commit 6a1cd8b92.