mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Reject currtid2() on unlogged tables during recovery.
Commit1e707d3256made COPY TO report a proper error for unlogged tables during recovery. currtid2() has the same problem: it reads the table directly without going through the planner, so on a standby it failed with a low-level error for an unlogged table: ERROR: could not open file "base/5/16384": No such file or directory Check for this case and report the same error as SELECT. No test is added, as currtid2() is an undocumented internal function. Backpatch to all supported versions, like commit1e707d3256. Reported-by: Masahiko Sawada <sawada.mshk@gmail.com> Author: Jim Jones <jim.jones@uni-muenster.de> Discussion: https://postgr.es/m/CAD21AoDNa7pL760_23AN_wYPMkWXCt+Kw0_vJAcci4R5DoCQGg@mail.gmail.com Backpatch-through: 14
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "access/sysattr.h"
|
#include "access/sysattr.h"
|
||||||
#include "access/table.h"
|
#include "access/table.h"
|
||||||
#include "access/tableam.h"
|
#include "access/tableam.h"
|
||||||
|
#include "access/xlog.h"
|
||||||
#include "catalog/namespace.h"
|
#include "catalog/namespace.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
#include "common/hashfn.h"
|
#include "common/hashfn.h"
|
||||||
@@ -345,6 +346,12 @@ currtid_internal(Relation rel, const ItemPointerData *tid)
|
|||||||
get_namespace_name(RelationGetNamespace(rel)),
|
get_namespace_name(RelationGetNamespace(rel)),
|
||||||
RelationGetRelationName(rel)));
|
RelationGetRelationName(rel)));
|
||||||
|
|
||||||
|
/* Temporary and unlogged relations are inaccessible during recovery. */
|
||||||
|
if (!RelationIsPermanent(rel) && RecoveryInProgress())
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("cannot access temporary or unlogged relations during recovery")));
|
||||||
|
|
||||||
ItemPointerCopy(tid, result);
|
ItemPointerCopy(tid, result);
|
||||||
|
|
||||||
snapshot = RegisterSnapshot(GetLatestSnapshot());
|
snapshot = RegisterSnapshot(GetLatestSnapshot());
|
||||||
|
|||||||
Reference in New Issue
Block a user