summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-06-14 12:51:32 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-06-14 12:51:32 -0400
commit2dbcf515ae1e8845d4903169ff81c91806c34d32 (patch)
treebd7cbff62885e15d09d4afa450256ef565dfca97 /src
parent14b3ec6f3047f672783654135bad78e7f4d17575 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/brin/brin.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c
index 795354ea1b7..49d92133950 100644
--- a/src/backend/access/brin/brin.c
+++ b/src/backend/access/brin/brin.c
@@ -20,6 +20,7 @@
#include "access/brin_page.h"
#include "access/brin_pageops.h"
#include "access/brin_xlog.h"
+#include "access/xlog.h"
#include "access/reloptions.h"
#include "access/relscan.h"
#include "access/xact.h"
@@ -792,6 +793,12 @@ brin_summarize_new_values(PG_FUNCTION_ARGS)
Relation heapRel;
double numSummarized = 0;
+ if (RecoveryInProgress())
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("recovery is in progress"),
+ errhint("BRIN control functions cannot be executed during recovery.")));
+
/*
* We must lock table before index to avoid deadlocks. However, if the
* passed indexoid isn't an index then IndexGetRelation() will fail.