diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-06-14 12:51:32 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-06-14 12:51:32 -0400 |
commit | 74da7cda31c07122257c527d9fd068dc28493fc8 (patch) | |
tree | 9d8ae0956a8295ae968f81b67cb257db2ab60ff9 /src | |
parent | dc878ffedf2aa461b11b617094101e3c4cf48daa (diff) | |
download | postgresql-74da7cda31c07122257c527d9fd068dc28493fc8.tar.gz postgresql-74da7cda31c07122257c527d9fd068dc28493fc8.zip |
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index 60e650dfee8..e95fbbcea74 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -871,6 +871,12 @@ brin_summarize_range(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."))); + if (heapBlk64 > BRIN_ALL_BLOCKRANGES || heapBlk64 < 0) { char *blk = psprintf(INT64_FORMAT, heapBlk64); @@ -942,6 +948,12 @@ brin_desummarize_range(PG_FUNCTION_ARGS) Relation indexRel; bool done; + 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."))); + if (heapBlk64 > MaxBlockNumber || heapBlk64 < 0) { char *blk = psprintf(INT64_FORMAT, heapBlk64); |