Re: Resetting a single statistics counter
| От | Tom Lane |
|---|---|
| Тема | Re: Resetting a single statistics counter |
| Дата | |
| Msg-id | 28364.1264356262@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Resetting a single statistics counter (Magnus Hagander <magnus@hagander.net>) |
| Список | 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 по дате отправления: