blob: db8de4bbe85c1a0c7989cc40170b871a7bd2098d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
-- Tests for REINDEX CONCURRENTLY
CREATE EXTENSION injection_points;
-- Check safety of indexes with predicates and expressions.
SELECT injection_points_set_local();
injection_points_set_local
----------------------------
(1 row)
SELECT injection_points_attach('reindex-conc-index-safe', 'notice');
injection_points_attach
-------------------------
(1 row)
SELECT injection_points_attach('reindex-conc-index-not-safe', 'notice');
injection_points_attach
-------------------------
(1 row)
CREATE SCHEMA reindex_inj;
CREATE TABLE reindex_inj.tbl(i int primary key, updated_at timestamp);
CREATE UNIQUE INDEX ind_simple ON reindex_inj.tbl(i);
CREATE UNIQUE INDEX ind_expr ON reindex_inj.tbl(ABS(i));
CREATE UNIQUE INDEX ind_pred ON reindex_inj.tbl(i) WHERE mod(i, 2) = 0;
CREATE UNIQUE INDEX ind_expr_pred ON reindex_inj.tbl(abs(i)) WHERE mod(i, 2) = 0;
REINDEX INDEX CONCURRENTLY reindex_inj.ind_simple;
NOTICE: notice triggered for injection point reindex-conc-index-safe
REINDEX INDEX CONCURRENTLY reindex_inj.ind_expr;
NOTICE: notice triggered for injection point reindex-conc-index-not-safe
REINDEX INDEX CONCURRENTLY reindex_inj.ind_pred;
NOTICE: notice triggered for injection point reindex-conc-index-not-safe
REINDEX INDEX CONCURRENTLY reindex_inj.ind_expr_pred;
NOTICE: notice triggered for injection point reindex-conc-index-not-safe
-- Cleanup
SELECT injection_points_detach('reindex-conc-index-safe');
injection_points_detach
-------------------------
(1 row)
SELECT injection_points_detach('reindex-conc-index-not-safe');
injection_points_detach
-------------------------
(1 row)
DROP TABLE reindex_inj.tbl;
DROP SCHEMA reindex_inj;
DROP EXTENSION injection_points;
|