mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
Mark pg_stat_reset_shared as strict
This is the proper fix for bug #6082 about
pg_stat_reset_shared(NULL) causing a crash, and it reverts
commit 79aa44536f
on head.
The workaround of throwing an error from inside the function is
left on backbranches (including 9.1) since this change requires
a new initdb.
This commit is contained in:
@ -1537,17 +1537,9 @@ pg_stat_reset(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
pg_stat_reset_shared(PG_FUNCTION_ARGS)
|
||||
{
|
||||
if (PG_ARGISNULL(0))
|
||||
/*
|
||||
* Same error message as in pgstat_reset_shared_counters(),
|
||||
* to keep translations the same.
|
||||
*/
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("unrecognized reset target: \"%s\"", "null"),
|
||||
errhint("Target must be \"bgwriter\".")));
|
||||
char *target = text_to_cstring(PG_GETARG_TEXT_PP(0));
|
||||
|
||||
pgstat_reset_shared_counters(text_to_cstring(PG_GETARG_TEXT_PP(0)));
|
||||
pgstat_reset_shared_counters(target);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
Reference in New Issue
Block a user