Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group