Re: [BUGS] Bug in pg_autovacuum ?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Cott Lang <cott(at)internetstaff(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [BUGS] Bug in pg_autovacuum ?
Date: 2004-02-11 22:29:09
Message-ID: 200402112229.i1BMT9W24168@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


Would someone review these problems and submit a patch? Thanks.

---------------------------------------------------------------------------

Tom Lane wrote:
> Cott Lang <cott(at)internetstaff(dot)com> writes:
> > If the number of tuples is sufficiently high, pg reports 'reltuples'
> > back in TABLE_STATS_QUERY in scientific notation instead of an integer.
>
> Right, because that column is actually a float4.
>
> > Changing from atoi() to atof() solves the problem completely.
>
> > new_tbl->reltuples =
> > atof(PQgetvalue(res, row, PQfnumber(res, "reltuples")));
>
> > new_tbl->relpages =
> > atof(PQgetvalue(res, row, PQfnumber(res, "relpages")));
>
> I should think this would break in different ways once reltuples exceeds
> INT_MAX. A full fix would require changing new_tbl->reltuples to be
> float or double, and coping with any downstream changes that implies.
>
> Also, relpages *is* an integer, though it's best interpreted as an
> unsigned one. (Ditto for relid.) Looks like this code is 0-for-3 on
> getting the datatypes right :-(
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Matthew T. O'Connor 2004-02-11 22:57:19 Re: [BUGS] Bug in pg_autovacuum ?
Previous Message Bruce Momjian 2004-02-11 22:04:32 Re: I find a bug (IMHO)

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-02-11 22:44:10 Re: SET WITHOUT OIDS and VACUUM badness?
Previous Message Rod Taylor 2004-02-11 22:24:18 Re: How can I have 2 completely seperated databases in