> Also, this issue is not limited to replica identity. CLUSTER ON does
> not copy/restore indisclustered on partition indexes at all, and this
> should be addressed as well, right?

Robert (cc'd) reminded me offline that REPACK ... USING INDEX ==
CLUSTER ON.

Here is a repro, and CLUSTER ON also shows the same behavior.

```
postgres=# CREATE TABLE test_cluster_multi (a int NOT NULL, b int NOT
NULL) PARTITION BY RANGE (a);
CREATE TABLE
postgres=# CREATE TABLE test_cluster_multi_p1 PARTITION OF test_cluster_multi
postgres-#     FOR VALUES FROM (0) TO (100);
CREATE TABLE
postgres=# CREATE INDEX test_cluster_multi_idx ON test_cluster_multi (a, b);
CREATE INDEX
postgres=# CREATE INDEX test_cluster_multi_other ON test_cluster_multi (b);
CREATE INDEX
postgres=# --CLUSTER test_cluster_multi_p1 USING test_cluster_multi_p1_a_b_idx;
postgres=# REPACK test_cluster_multi_p1 USING INDEX
test_cluster_multi_p1_a_b_idx;
REPACK
postgres=# SELECT tc.relname AS table_name, ic.relname AS index_name,
i.indisclustered
postgres-#   FROM pg_index i
postgres-#   JOIN pg_class tc ON i.indrelid = tc.oid
postgres-#   JOIN pg_class ic ON i.indexrelid = ic.oid
postgres-#   WHERE tc.relname = 'test_cluster_multi_p1'
postgres-#   ORDER BY ic.relname;
      table_name       |          index_name           | indisclustered
-----------------------+-------------------------------+----------------
 test_cluster_multi_p1 | test_cluster_multi_p1_a_b_idx | t
 test_cluster_multi_p1 | test_cluster_multi_p1_b_idx   | f
(2 rows)

postgres=# ALTER TABLE test_cluster_multi ALTER COLUMN b TYPE bigint;
ALTER TABLE
postgres=# SELECT tc.relname AS table_name, ic.relname AS index_name,
i.indisclustered
postgres-#   FROM pg_index i
postgres-#   JOIN pg_class tc ON i.indrelid = tc.oid
postgres-#   JOIN pg_class ic ON i.indexrelid = ic.oid
postgres-#   WHERE tc.relname = 'test_cluster_multi_p1'
postgres-#   ORDER BY ic.relname;
      table_name       |          index_name           | indisclustered
-----------------------+-------------------------------+----------------
 test_cluster_multi_p1 | test_cluster_multi_p1_a_b_idx | f
 test_cluster_multi_p1 | test_cluster_multi_p1_b_idx   | f
(2 rows)

postgres=# DROP TABLE test_cluster_multi;
DROP TABLE
```

--
Sami Imseih
Amazon Web Services (AWS)


Reply via email to