aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c14
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/catalog/pg_proc.h2
3 files changed, 5 insertions, 13 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();
}
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index d826b5d31cf..34e30aa1d4d 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 201106211
+#define CATALOG_VERSION_NO 201107031
#endif
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 6980d3e5315..16dc70f6fa3 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -2663,7 +2663,7 @@ DATA(insert OID = 2230 ( pg_stat_clear_snapshot PGNSP PGUID 12 1 0 0 0 f f f f
DESCR("statistics: discard current transaction's statistics snapshot");
DATA(insert OID = 2274 ( pg_stat_reset PGNSP PGUID 12 1 0 0 0 f f f f f v 0 0 2278 "" _null_ _null_ _null_ _null_ pg_stat_reset _null_ _null_ _null_ ));
DESCR("statistics: reset collected statistics for current database");
-DATA(insert OID = 3775 ( pg_stat_reset_shared PGNSP PGUID 12 1 0 0 0 f f f f f v 1 0 2278 "25" _null_ _null_ _null_ _null_ pg_stat_reset_shared _null_ _null_ _null_ ));
+DATA(insert OID = 3775 ( pg_stat_reset_shared PGNSP PGUID 12 1 0 0 0 f f f t f v 1 0 2278 "25" _null_ _null_ _null_ _null_ pg_stat_reset_shared _null_ _null_ _null_ ));
DESCR("statistics: reset collected statistics shared across the cluster");
DATA(insert OID = 3776 ( pg_stat_reset_single_table_counters PGNSP PGUID 12 1 0 0 0 f f f f f v 1 0 2278 "26" _null_ _null_ _null_ _null_ pg_stat_reset_single_table_counters _null_ _null_ _null_ ));
DESCR("statistics: reset collected statistics for a single table or index in the current database");