Re: pg_autovacuum patch for 7.4.2 and HEAD

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Matthew T(dot) O'Connor" <matthew(at)zeut(dot)net>
Cc: "'pgsql-patches(at)postgresql(dot)org'" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_autovacuum patch for 7.4.2 and HEAD
Date: 2004-03-05 05:04:31
Message-ID: 3086.1078463071@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

"Matthew T. O'Connor" <matthew(at)zeut(dot)net> writes:
> pg_autovacuum.c has some problems with int overflow and not using appropriate
> datatypes to track certain table values. This patch attempts to fix all
> these issues. Someone should take a look and make sure its valid.

> ! new_tbl->relid = atol(PQgetvalue(res, row, PQfnumber(res, "oid")));
> ! new_tbl->reltuples = atof(PQgetvalue(res, row, PQfnumber(res, "reltuples")));
> ! new_tbl->relpages = atol(PQgetvalue(res, row, PQfnumber(res, "relpages")));

This ignores the fact that relid and relpages are unsigned. I would
suggest adopting the same convention for OID as is used in pg_dump and
other places:

#define atooid(x) ((Oid) strtoul((x), NULL, 10))

You could actually use this same macro for reading relpages, but that's
probably abusing the notation. I'd use strtoul directly for relpages,
I think.

> ! init_dbinfo(char *dbname, int oid, int age)
> ...
> ! init_dbinfo(char *dbname, uint oid, uint age)

This (and other declarations) should be "Oid oid".

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2004-03-05 06:11:56 Re: [GENERAL] dblink: rollback transaction
Previous Message Bruce Momjian 2004-03-05 04:49:58 Re: notice about costly ri checks (2)