Don't try to rebuild invalid indexes

Closes ticket #9
This commit is contained in:
Daniele Varrazzo
2012-10-16 23:29:36 +01:00
parent df12c37edf
commit 9f5c4f55c7
4 changed files with 33 additions and 1 deletions

View File

@ -46,6 +46,10 @@ CREATE TABLE tbl_with_dropped_toast (
PRIMARY KEY (i, j)
);
ALTER TABLE tbl_with_dropped_toast CLUSTER ON tbl_with_dropped_toast_pkey;
CREATE TABLE tbl_badindex (
id integer PRIMARY KEY,
n integer
);
--
-- insert data
--
@ -71,6 +75,11 @@ CREATE VIEW view_for_dropped_column AS
INSERT INTO tbl_with_dropped_toast VALUES(1, 10, 'abc');
INSERT INTO tbl_with_dropped_toast VALUES(2, 20, sqrt(2::numeric(1000,999))::text || sqrt(3::numeric(1000,999))::text);
ALTER TABLE tbl_with_dropped_toast DROP COLUMN t;
INSERT INTO tbl_badindex VALUES(1, 10);
INSERT INTO tbl_badindex VALUES(2, 10);
CREATE UNIQUE INDEX CONCURRENTLY idx_badindex_n ON tbl_badindex (n);
ERROR: could not create unique index "idx_badindex_n"
DETAIL: Key (n)=(10) is duplicated.
--
-- before
--
@ -99,6 +108,7 @@ SELECT * FROM tbl_with_dropped_toast;
-- do reorg
--
\! pg_reorg --dbname=contrib_regression --no-order
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
\! pg_reorg --dbname=contrib_regression
\! pg_reorg --dbname=contrib_regression --table=tbl_cluster
--