aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2011-07-03 13:15:58 +0200
committerMagnus Hagander <magnus@hagander.net>2011-07-03 13:15:58 +0200
commit24e2d4b6ba99985d5b710983714f0133e94dc343 (patch)
tree7df4628835cf65786b5e9df8527edb6edf61e050 /src/backend/utils/adt/pgstatfuncs.c
parent426cafc46c8bf5aeda38e8d17f1d86a48e627e43 (diff)
downloadpostgresql-24e2d4b6ba99985d5b710983714f0133e94dc343.tar.gz
postgresql-24e2d4b6ba99985d5b710983714f0133e94dc343.zip
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 79aa44536f3980d324f486504cde643ce23bf5c6 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.
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 4d07bdd24bd..12dbff4c9a9 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -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\".")));
-
- pgstat_reset_shared_counters(text_to_cstring(PG_GETARG_TEXT_PP(0)));
+ char *target = text_to_cstring(PG_GETARG_TEXT_PP(0));
+
+ pgstat_reset_shared_counters(target);
PG_RETURN_VOID();
}