Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nXLAP-0006uU-Lc for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Mar 2022 10:58:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nXLAN-0002Z7-Ci for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Mar 2022 10:58:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nXLAN-0002Yy-2T for pgsql-hackers@lists.postgresql.org; Thu, 24 Mar 2022 10:58:07 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nXLAH-0003eg-UP for pgsql-hackers@postgresql.org; Thu, 24 Mar 2022 10:58:06 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 6E3EE5C01E3; Thu, 24 Mar 2022 06:57:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 24 Mar 2022 06:57:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=/y/8flhMv93Qe9IAogxG2lxSju2FnkTi3T0RHaGJs /I=; b=BIIpcpWkkuOXEUTBDVoDW9th1vYfZMt4V68xWM7RffIhIuTdnpGh2Tc8k qmA/IbB6cWlC4nQIW33taMPnw1lk0FJPzAbiX2GBDrtMdHB2kXTPzofPmyekSlp5 S32/NoJmaAyuJTUy9M3RVdBvOYl2y4BNf2MNVLIiVQJCqQXySDh4UKOadeoygT9G 4YDDg1cjaXphTgBzJIW97xUKXT01S2arOGKstA1eF8CSIyDr7RR673sHdT8gzwi7 oaMK4q4S/lE5UvSgEYPE/p7O2Hs6xbhT2tkbh6RQEDyVMpR+RlLJ2MYnNBuiQyT/ Q8tnjckldj93XIIDqEj/PPxEzsOgg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudegledgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeejgeehteeuhfevvedu leeufedtjeetiefftedvudfhtdeifefgueettdevgefgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Mar 2022 06:57:58 -0400 (EDT) Message-ID: Date: Thu, 24 Mar 2022 11:57:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] add relation and block-level filtering to pg_waldump Content-Language: en-US To: Thomas Munro Cc: David Christensen , Bharath Rupireddy , PostgreSQL-development References: From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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?