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

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] fix two shadow vars (src/backend/commands/sequence.c)
Date: 2020-06-12 01:20:09
Message-ID: CAEudQAov2B+PFEokvd9rXFtP99iYT4RRsiMCK9-SC_D9YhRu0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qui., 11 de jun. de 2020 às 19:54, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> escreveu:

> Ranier Vilela <ranier(dot)vf(at)gmail(dot)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 Content-Type Size
fix_shadows_buf_var_v2.patch application/octet-stream 2.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-06-12 01:25:41 Re: exp() versus the POSIX standard
Previous Message Tom Lane 2020-06-12 01:16:22 Infinities in type numeric