> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> It all works now and I have just submitted it to -patches as a
> new contrib,
> >> but it probably should make its way into the backend one day.
>
> > OK, the big question is how do we want to make stats reset visible to
> > users? The current patch uses a function call. Is that how we want to
> > do it?
>
> Should we make it visible at all? I'm concerned about security.
The function it's calling in the backend:
void
pgstat_reset_counters(void)
{ PgStat_MsgResetcounter msg;
if (pgStatSock < 0) return;
if (!superuser()) elog(ERROR, "Only database superusers can reset statistic
counters");
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_RESETCOUNTER); pgstat_send(&msg, sizeof(msg));
}
Note it does actually check that you're a superuser...
Chris