public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: Thomas Munro <[email protected]>
Cc: David Christensen <[email protected]>
Cc: Bharath Rupireddy <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: [PATCH] add relation and block-level filtering to pg_waldump
Date: Thu, 24 Mar 2022 11:57:56 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+hUKGLGS8mJuTxNPVMqEg2Whr6Gg3OSMuWaZYhws1HmQHLQ-A@mail.gmail.com>
References: <[email protected]>
<CALj2ACXjZRWXvUhvUh7xJeRJd7i40KXdS7p6eHHq+q4+xUNf9w@mail.gmail.com>
<[email protected]>
<CA+hUKGL6Oh86gBFT0fwLz7=fOpFWm4-fu6Xo9X9VcOKuJ6t9ow@mail.gmail.com>
<CA+hUKG+i5mp1cxQ0B_04Pq6BJB_k=KfL0b2fdAQtKrGapapmbg@mail.gmail.com>
<[email protected]>
<CA+hUKGLGS8mJuTxNPVMqEg2Whr6Gg3OSMuWaZYhws1HmQHLQ-A@mail.gmail.com>
On 23.03.22 23:54, Thomas Munro wrote:
>> That's because ForkNum is a signed type. You will probably succeed if
>> you use "%d" instead.
>
> Erm, is that really OK? C says "Each enumerated type shall be
> compatible with char, a signed integer type, or an
> unsigned integer type. The choice of type is implementation-defined,
> but shall be capable of representing the values of all the members of
> the enumeration." It could even legally vary from enum to enum,
> though in practice most compilers probably just use ints all the time
> unless you use weird pragma pack incantation. Therefore I think you
> need an intermediate variable with the size and signedness matching the
> format string, if you're going to scanf directly into it, which
> David's V6 did.
An intermediate variable is probably the best way to avoid thinking
about this much more. ;-) But note that the committed patch uses a %u
format whereas the ForkNum enum is signed.
Btw., why the sscanf() instead of just strtol/stroul?
view thread (16+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] add relation and block-level filtering to pg_waldump
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox