Revert "Improve error message on snapshot import in snapmgr.c"
authorMichael Paquier <[email protected]>
Thu, 14 Sep 2023 07:00:41 +0000 (16:00 +0900)
committerMichael Paquier <[email protected]>
Thu, 14 Sep 2023 07:00:41 +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[email protected]
Backpatch-through: 11

src/backend/utils/time/snapmgr.c

index dbba2f7d7b27339fdc1c8fea84790c5b93f67181..3037cf478d1dece60e8f8f065b04c0f4a34c6c20 100644 (file)
@@ -1443,9 +1443,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))