Re: [GENERAL] Stats Collector

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Jan Wieck" <JanWieck(at)Yahoo(dot)com>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] Stats Collector
Date: 2002-07-29 03:51:25
Message-ID: GNELIHDDFBOCMGBFGEFOGEGCCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> Looks to me, someone forgot something. That would be me and now I
> remember that I originally wanted to add some utility command for that.
>
> What you need in the meantime is a little C function that calls
>
> void pgstat_reset_counters(void);
>
> I might find the time tomorrow to write one for you if you don't know
> how.

Is this the kind of thing you mean?

#include "postgres.h"
#include "fmgr.h"

extern Datum pg_reset_stats(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(pg_reset_stats);

Datum
pg_reset_stats(PG_FUNCTION_ARGS)
{
void pgstat_reset_counters(void);

PG_RETURN_VOID();
}

With this code I get this:

test=# select pg_reset_stats();
ERROR: Unable to look up type id 0

I'm creating it like this:

create or replace function pg_reset_stats() returns opaque as
'/home/chriskl/local/lib/postgresql/pg_reset_stats.so'
language 'C';

Is it something to do with the return type being declared wrongly?
Hmm...the manual indicates that opaque functions cannot be called directly -
so what the heck do I do?

Also, where would I put this function in the main postgres source and how
would I modify initdb?

Chris

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Cheung Tin Ka 2002-07-29 04:16:14 type conversion between text and timestamp
Previous Message Bruce Momjian 2002-07-29 03:25:50 Re: Is this query possible in PostgreSQL ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-07-29 05:24:34 anonymous composite types for Table Functions (aka SRFs)
Previous Message Larry Rosenman 2002-07-29 02:58:46 Re: Virus Emails