mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
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
This commit is contained in:
parent
476ba1ec98
commit
3b5f4f1f40
@ -868,6 +868,12 @@ brin_summarize_range(PG_FUNCTION_ARGS)
|
|||||||
Relation heapRel;
|
Relation heapRel;
|
||||||
double numSummarized = 0;
|
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)
|
if (heapBlk64 > BRIN_ALL_BLOCKRANGES || heapBlk64 < 0)
|
||||||
{
|
{
|
||||||
char *blk = psprintf(INT64_FORMAT, heapBlk64);
|
char *blk = psprintf(INT64_FORMAT, heapBlk64);
|
||||||
@ -939,6 +945,12 @@ brin_desummarize_range(PG_FUNCTION_ARGS)
|
|||||||
Relation indexRel;
|
Relation indexRel;
|
||||||
bool done;
|
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)
|
if (heapBlk64 > MaxBlockNumber || heapBlk64 < 0)
|
||||||
{
|
{
|
||||||
char *blk = psprintf(INT64_FORMAT, heapBlk64);
|
char *blk = psprintf(INT64_FORMAT, heapBlk64);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user