Re: BUG #4238: pg_class.relhasindex not updated by vacuum

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Lawrence Cohan" <lawrencec(at)1shoppingcart(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4238: pg_class.relhasindex not updated by vacuum
Date: 2008-06-13 15:44:00
Message-ID: 11627.1213371840@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Lawrence Cohan" <lawrencec(at)1shoppingcart(dot)com> writes:
> We rely on this column to build a list of tables restricted to only those
> that have indexes to be rebuilt with CONCURRENTLY however the column is not
> updated as documentation says by the vacuum. After a successful
> analyze/vacuum/analyze against the entire database ALL tables from pg_class
> have the pg_class.relhasindex = true even if they don't have any indexes.

Works as documented for me ...

regression=# create table foo(f1 int);
CREATE TABLE
regression=# select relhasindex from pg_class where relname = 'foo';
relhasindex
-------------
f
(1 row)

regression=# create index fooi on foo(f1);
CREATE INDEX
regression=# select relhasindex from pg_class where relname = 'foo';
relhasindex
-------------
t
(1 row)

regression=# drop index fooi;
DROP INDEX
regression=# select relhasindex from pg_class where relname = 'foo';
relhasindex
-------------
t
(1 row)

regression=# vacuum foo;
VACUUM
regression=# select relhasindex from pg_class where relname = 'foo';
relhasindex
-------------
f
(1 row)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Lawrence Cohan 2008-06-13 15:56:32 Re: BUG #4238: pg_class.relhasindex not updated by vacuum
Previous Message Lawrence Cohan 2008-06-13 14:34:04 BUG #4238: pg_class.relhasindex not updated by vacuum