Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c)

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c)
Дата
Msg-id CAEudQAov2B+PFEokvd9rXFtP99iYT4RRsiMCK9-SC_D9YhRu0A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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
Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Infinities in type numeric
Следующее
От: Tom Lane
Дата:
Сообщение: Re: exp() versus the POSIX standard