1 -- Tests for REINDEX CONCURRENTLY
2 CREATE EXTENSION injection_points;
4 -- Check safety of indexes with predicates and expressions.
5 SELECT injection_points_set_local();
6 SELECT injection_points_attach('reindex-conc-index-safe', 'notice');
7 SELECT injection_points_attach('reindex-conc-index-not-safe', 'notice');
9 CREATE SCHEMA reindex_inj;
10 CREATE TABLE reindex_inj.tbl(i int primary key, updated_at timestamp);
12 CREATE UNIQUE INDEX ind_simple ON reindex_inj.tbl(i);
13 CREATE UNIQUE INDEX ind_expr ON reindex_inj.tbl(ABS(i));
14 CREATE UNIQUE INDEX ind_pred ON reindex_inj.tbl(i) WHERE mod(i, 2) = 0;
15 CREATE UNIQUE INDEX ind_expr_pred ON reindex_inj.tbl(abs(i)) WHERE mod(i, 2) = 0;
17 REINDEX INDEX CONCURRENTLY reindex_inj.ind_simple;
18 REINDEX INDEX CONCURRENTLY reindex_inj.ind_expr;
19 REINDEX INDEX CONCURRENTLY reindex_inj.ind_pred;
20 REINDEX INDEX CONCURRENTLY reindex_inj.ind_expr_pred;
23 SELECT injection_points_detach('reindex-conc-index-safe');
24 SELECT injection_points_detach('reindex-conc-index-not-safe');
25 DROP TABLE reindex_inj.tbl;
26 DROP SCHEMA reindex_inj;
28 DROP EXTENSION injection_points;