diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/statistics/attribute_stats.c | 12 | ||||
-rw-r--r-- | src/backend/statistics/relation_stats.c | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c index 4ae0722b781..686f2e639c6 100644 --- a/src/backend/statistics/attribute_stats.c +++ b/src/backend/statistics/attribute_stats.c @@ -155,6 +155,12 @@ attribute_statistics_update(FunctionCallInfo fcinfo, int elevel) stats_check_required_arg(fcinfo, attarginfo, ATTRELATION_ARG); reloid = PG_GETARG_OID(ATTRELATION_ARG); + if (RecoveryInProgress()) + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("recovery is in progress"), + errhint("Statistics cannot be modified during recovery."))); + /* lock before looking up attribute */ stats_lock_check_privileges(reloid); @@ -865,6 +871,12 @@ pg_clear_attribute_stats(PG_FUNCTION_ARGS) stats_check_required_arg(fcinfo, attarginfo, ATTRELATION_ARG); reloid = PG_GETARG_OID(ATTRELATION_ARG); + if (RecoveryInProgress()) + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("recovery is in progress"), + errhint("Statistics cannot be modified during recovery."))); + stats_lock_check_privileges(reloid); stats_check_required_arg(fcinfo, attarginfo, ATTNAME_ARG); diff --git a/src/backend/statistics/relation_stats.c b/src/backend/statistics/relation_stats.c index ed5dea2e058..e619d5cf5b1 100644 --- a/src/backend/statistics/relation_stats.c +++ b/src/backend/statistics/relation_stats.c @@ -72,6 +72,12 @@ relation_statistics_update(FunctionCallInfo fcinfo, int elevel) stats_check_required_arg(fcinfo, relarginfo, RELATION_ARG); reloid = PG_GETARG_OID(RELATION_ARG); + if (RecoveryInProgress()) + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("recovery is in progress"), + errhint("Statistics cannot be modified during recovery."))); + stats_lock_check_privileges(reloid); /* |