Re: Add contrib/pg_logicalsnapinspect - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Add contrib/pg_logicalsnapinspect
Date
Msg-id 6dd0f118-ce86-4b98-af2c-1319e1593a15@eisentraut.org
Whole thread Raw
In response to Re: Add contrib/pg_logicalsnapinspect  (shveta malik <shveta.malik@gmail.com>)
List pgsql-hackers
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?



pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: query_id, pg_stat_activity, extended query protocol
Next
From: Li Japin
Date:
Subject: Re: [PATCH] Support Int64 GUCs