Re: Resetting a single statistics counter - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Resetting a single statistics counter
Date
Msg-id 28364.1264356262@sss.pgh.pa.us
Whole thread Raw
In response to Re: Resetting a single statistics counter  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> Here goes.

Looks much saner.  One minor stylistic gripe:

+Datum
+pg_stat_reset_single_table(PG_FUNCTION_ARGS)
+{
+    pgstat_reset_single_counter(PG_GETARG_OID(0), RESET_TABLE);
+
+    PG_RETURN_VOID();
+}

I don't like sticking PG_GETARG calls inline in the body of a V1-protocol
function, even in trivial cases like this.  I think better style is
Oid    taboid = PG_GETARG_OID(0);
pgstat_reset_single_counter(taboid, RESET_TABLE);

This approach associates a clear name and type with each argument,
thereby helping to buy back some of the readability we lose by not
being able to use regular C function declarations.  When we designed
the V1 call protocol, I had hoped we might someday have scripts that
would crosscheck such declarations against the pg_proc contents, and
I still haven't entirely given up that idea ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Review: listagg aggregate
Next
From: Euler Taveira de Oliveira
Date:
Subject: Re: Resetting a single statistics counter