| 1 |
# REINDEX with schemas |
| 2 |
# |
| 3 |
# Check that concurrent drop of relations while doing a REINDEX |
| 4 |
# SCHEMA allows the command to work. |
| 5 |
|
| 6 |
setup |
| 7 |
{ |
| 8 |
CREATE SCHEMA reindex_schema; |
| 9 |
CREATE TABLE reindex_schema.tab_locked (a int PRIMARY KEY); |
| 10 |
CREATE TABLE reindex_schema.tab_dropped (a int PRIMARY KEY); |
| 11 |
} |
| 12 |
|
| 13 |
teardown |
| 14 |
{ |
| 15 |
DROP SCHEMA reindex_schema CASCADE; |
| 16 |
} |
| 17 |
|
| 18 |
session s1 |
| 19 |
step begin1 { BEGIN; } |
| 20 |
step lock1 { LOCK reindex_schema.tab_locked IN SHARE UPDATE EXCLUSIVE MODE; } |
| 21 |
step end1 { COMMIT; } |
| 22 |
|
| 23 |
session s2 |
| 24 |
step reindex2 { REINDEX SCHEMA reindex_schema; } |
| 25 |
step reindex_conc2 { REINDEX SCHEMA CONCURRENTLY reindex_schema; } |
| 26 |
|
| 27 |
session s3 |
| 28 |
step drop3 { DROP TABLE reindex_schema.tab_dropped; } |
| 29 |
|
| 30 |
# The table can be dropped while reindex is waiting. |
| 31 |
permutation begin1 lock1 reindex2 drop3 end1 |
| 32 |
permutation begin1 lock1 reindex_conc2 drop3 end1 |