Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c)
Date
Msg-id CAEudQAov2B+PFEokvd9rXFtP99iYT4RRsiMCK9-SC_D9YhRu0A@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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.

regards,
Ranier Vilela
 

                        regards, tom lane
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Infinities in type numeric
Next
From: Tom Lane
Date:
Subject: Re: exp() versus the POSIX standard