Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stSdP-00GZ3w-FB for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Sep 2024 14:04:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1stSdO-0095ce-SR for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Sep 2024 14:04:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stSdN-0095Ze-BD for pgsql-hackers@lists.postgresql.org; Wed, 25 Sep 2024 14:04:50 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1stSdK-00100q-Jn for pgsql-hackers@lists.postgresql.org; Wed, 25 Sep 2024 14:04:48 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id 20A18138045F; Wed, 25 Sep 2024 10:04:45 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Wed, 25 Sep 2024 10:04:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1727273085; x=1727359485; bh=HBgsRQGu4kKDoBrr+nSkbDybxhphCcp6 hBkmOSjLmnM=; b=EYBVo5PL9y65mLI7gmDo18e2xmIKQ/lIGeG5iENLZ0e2Ijpp VefKue0XqZB1ORNMY5KyEFLjtLNXgDFBeR3dQLx8PZQcTUBSmFeVm5xxi6NaH8NH KLGeg/UEsXnA/tlRRz75V+NTEJPQXkKV0B0AwPdVvcDZsqI6Bc/ceFi7mCiC+jiU HmsVXo0OCifA0hZyF1i5uQizJQKrUVlIwm2ntYdQKGhaBIY5EzD+nkzJ/CpyCWM1 cx25Kh+f4XruOYKCX1NHhrj+Z7SPF5mzpzKZACwPoMILAT+oKTISifaSR7vhQZwC LkutwsLUQZG+aU8ZcLGOBH81T6GhAWJiMhusiw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727273085; x= 1727359485; bh=HBgsRQGu4kKDoBrr+nSkbDybxhphCcp6hBkmOSjLmnM=; b=L nZ7nQtEVpWt4v3w7MqB9PGa0vGqGr8CXZeiNSfjOmo/CotwXUaXQKlSBkzm9V937 A+cm8uG5XUP/cqOGZsb6t0eTxGSl/XSgD4uPmJwyIq+zD+9rHPYQEsWENjOFfNZv 7E3aYmcxcfbgNtiDhUiWs8MaP0He5hb6nt9Tw73zlTU/bd6Zf8oGBraUjow7tTK5 N08yTlypykz13poCrCWkluWD3dizQS8AKyehWej6unsPfnKp0oIRhOZWh+t93HVM 78SZ6oM6F4ou2IEhAOWVReEywNynCFjpwWiWkYCMfjPhY4EOnIINIRBTqOT9KRok dw1RN5FlCNFFOu4y6EV+A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddthedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvihhsvg hnthhrrghuthdrohhrgheqnecuggftrfgrthhtvghrnhepgfejtdfhkeeftdeugfeileeh teeljeeghfeuledthfeutedvffdukeefjefhgeehnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhhtrdho rhhgpdhnsggprhgtphhtthhopeeipdhmohguvgepshhmthhpohhuthdprhgtphhtthhope gsvghrthhrrghnuggurhhouhhvohhtrdhpghesghhmrghilhdrtghomhdprhgtphhtthho pehsmhhithhhphgsvddvhedtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhhvhgvth grrdhmrghlihhksehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghmihhtrdhkrghpihhl rgduieesghhmrghilhdrtghomhdprhgtphhtthhopegshhgrrhgrthhhrdhruhhpihhrvg guugihfhhorhhpohhsthhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehpghhs qhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 25 Sep 2024 10:04:43 -0400 (EDT) Message-ID: <6dd0f118-ce86-4b98-af2c-1319e1593a15@eisentraut.org> Date: Wed, 25 Sep 2024 16:04:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add contrib/pg_logicalsnapinspect To: Bertrand Drouvot , Peter Smith Cc: shveta malik , Amit Kapila , Bharath Rupireddy , pgsql-hackers@lists.postgresql.org References: Content-Language: en-US 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 Is there a reason for this elaborate error handling: + fd = OpenTransientFile(path, O_RDONLY | PG_BINARY); + + if (fd < 0 && errno == ENOENT) + ereport(ERROR, + errmsg("file \"%s\" does not exist", path)); + else if (fd < 0) + ereport(ERROR, + (errcode_for_file_access(), + errmsg("could not open file \"%s\": %m", path))); Couldn't you just use the second branch for all errno's?