Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 74da7cd

Browse files
committed
Fail BRIN control functions during recovery explicitly
They already fail anyway, but prior to this patch they raise an ugly error message about a lock that cannot be acquired. This just improves the message. Author: Masahiko Sawada Reported-by: Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoBZau4g4_NUf3BKNd=CdYK+xaPdtJCzvOC1TxGdTiJx_Q@mail.gmail.com Reviewed-by: Kuntal Ghosh, Alexander Korotkov, Simon Riggs, Michaël Paquier, Álvaro Herrera
1 parent dc878ff commit 74da7cd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/backend/access/brin/brin.c

+12
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,12 @@ brin_summarize_range(PG_FUNCTION_ARGS)
871871
Relation heapRel;
872872
double numSummarized = 0;
873873

874+
if (RecoveryInProgress())
875+
ereport(ERROR,
876+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
877+
errmsg("recovery is in progress"),
878+
errhint("BRIN control functions cannot be executed during recovery.")));
879+
874880
if (heapBlk64 > BRIN_ALL_BLOCKRANGES || heapBlk64 < 0)
875881
{
876882
char *blk = psprintf(INT64_FORMAT, heapBlk64);
@@ -942,6 +948,12 @@ brin_desummarize_range(PG_FUNCTION_ARGS)
942948
Relation indexRel;
943949
bool done;
944950

951+
if (RecoveryInProgress())
952+
ereport(ERROR,
953+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
954+
errmsg("recovery is in progress"),
955+
errhint("BRIN control functions cannot be executed during recovery.")));
956+
945957
if (heapBlk64 > MaxBlockNumber || heapBlk64 < 0)
946958
{
947959
char *blk = psprintf(INT64_FORMAT, heapBlk64);

0 commit comments

Comments
 (0)