Skip to content

Commit 24e2d4b

Browse files
committed
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 79aa445 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.
1 parent 426cafc commit 24e2d4b

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

src/backend/utils/adt/pgstatfuncs.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,17 +1537,9 @@ pg_stat_reset(PG_FUNCTION_ARGS)
15371537
Datum
15381538
pg_stat_reset_shared(PG_FUNCTION_ARGS)
15391539
{
1540-
if (PG_ARGISNULL(0))
1541-
/*
1542-
* Same error message as in pgstat_reset_shared_counters(),
1543-
* to keep translations the same.
1544-
*/
1545-
ereport(ERROR,
1546-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1547-
errmsg("unrecognized reset target: \"%s\"", "null"),
1548-
errhint("Target must be \"bgwriter\".")));
1549-
1550-
pgstat_reset_shared_counters(text_to_cstring(PG_GETARG_TEXT_PP(0)));
1540+
char *target = text_to_cstring(PG_GETARG_TEXT_PP(0));
1541+
1542+
pgstat_reset_shared_counters(target);
15511543

15521544
PG_RETURN_VOID();
15531545
}

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201106211
56+
#define CATALOG_VERSION_NO 201107031
5757

5858
#endif

src/include/catalog/pg_proc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2663,7 +2663,7 @@ DATA(insert OID = 2230 ( pg_stat_clear_snapshot PGNSP PGUID 12 1 0 0 0 f f f f
26632663
DESCR("statistics: discard current transaction's statistics snapshot");
26642664
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_ ));
26652665
DESCR("statistics: reset collected statistics for current database");
2666-
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_ ));
2666+
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_ ));
26672667
DESCR("statistics: reset collected statistics shared across the cluster");
26682668
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_ ));
26692669
DESCR("statistics: reset collected statistics for a single table or index in the current database");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy