public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Bertrand Drouvot <[email protected]>
To: Peter Smith <[email protected]>
Cc: shveta malik <[email protected]>
Cc: Amit Kapila <[email protected]>
Cc: Bharath Rupireddy <[email protected]>
Cc: [email protected]
Subject: Re: Add contrib/pg_logicalsnapinspect
Date: Wed, 25 Sep 2024 16:04:43 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <ZuF2Okt7aBR//[email protected]>
	<CAJpy0uCgAQ5JeunSV2cXiLSegxKK5=DzRZOnJLcbyS82pwZjeg@mail.gmail.com>
	<ZuhBsL/[email protected]>
	<CAJpy0uCzAY3r42vB3nUa+HongRrFmfNQan1Y2Bs6XQEfuDSo2A@mail.gmail.com>
	<[email protected]>
	<CAHut+PuWLzfXO0ZDNEHhgz013OR-w8U_C+F+gpP+hu7eivGDPA@mail.gmail.com>
	<ZusgK0/B8F/[email protected]>
	<CAHut+PuqW+Xz_m5oYYNfBk5DjKJRS6t=5pnNKZnP21geBPMR_Q@mail.gmail.com>
	<[email protected]>
	<CAHut+PsVj9+DO6_zQrW8-n47DxuxFzwHKXOJi6AE3M9Yki9XPA@mail.gmail.com>
	<[email protected]>

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?






view thread (36+ 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], [email protected], [email protected], [email protected]
  Subject: Re: Add contrib/pg_logicalsnapinspect
  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