Re: BUG #4238: pg_class.relhasindex not updated by vacuum - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4238: pg_class.relhasindex not updated by vacuum
Date
Msg-id 11627.1213371840@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4238: pg_class.relhasindex not updated by vacuum  ("Lawrence Cohan" <lawrencec@1shoppingcart.com>)
Responses Re: BUG #4238: pg_class.relhasindex not updated by vacuum
List pgsql-bugs
"Lawrence Cohan" <lawrencec@1shoppingcart.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

pgsql-bugs by date:

Previous
From: "Lawrence Cohan"
Date:
Subject: BUG #4238: pg_class.relhasindex not updated by vacuum
Next
From: Tom Lane
Date:
Subject: Re: BUG #4238: pg_class.relhasindex not updated by vacuum