Revert "Improve error message on snapshot import in snapmgr.c"
authorMichael Paquier <michael@paquier.xyz>
Thu, 14 Sep 2023 07:00:01 +0000 (16:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 14 Sep 2023 07:00:01 +0000 (16:00 +0900)
This reverts commit a0d87bcd9b57, following a remark from Andres Frend
that the new error can be triggered with an incorrect SET TRANSACTION
SNAPSHOT command without being really helpful for the user as it uses
the internal file name.

Discussion: https://postgr.es/m/20230914020724.hlks7vunitvtbbz4@awork3.anarazel.de
Backpatch-through: 11

src/backend/utils/time/snapmgr.c

index 65230811c022c4f2a34d0938bd1ff2e50f78ce32..b20440ee21ff8ad836aa8ef72aa0d18fd3dd85f3 100644 (file)
@@ -1391,9 +1391,8 @@ ImportSnapshot(const char *idstr)
    f = AllocateFile(path, PG_BINARY_R);
    if (!f)
        ereport(ERROR,
-               (errcode_for_file_access(),
-                errmsg("could not open file \"%s\" for reading: %m",
-                       path)));
+               (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                errmsg("invalid snapshot identifier: \"%s\"", idstr)));
 
    /* get the size of the file so that we know how much memory we need */
    if (fstat(fileno(f), &stat_buf))