Skip to content

Commit 55238d5

Browse files
author
Sofia Kopikova
committed
[PBCKP-120] skip partitioned indexes for checkdb --amcheck
Tags: pg_probackup
1 parent acc8edc commit 55238d5

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/checkdb.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ get_index_list(const char *dbname, bool first_db_with_amcheck,
461461
"LEFT JOIN pg_catalog.pg_class cls ON idx.indexrelid=cls.oid "
462462
"LEFT JOIN pg_catalog.pg_namespace nmspc ON cls.relnamespace=nmspc.oid "
463463
"LEFT JOIN pg_catalog.pg_am am ON cls.relam=am.oid "
464-
"WHERE am.amname='btree' AND cls.relpersistence != 't' "
464+
"WHERE am.amname='btree' "
465+
"AND cls.relpersistence != 't' "
466+
"AND cls.relkind != 'I' "
465467
"ORDER BY nmspc.nspname DESC",
466468
0, NULL);
467469
}
@@ -473,8 +475,10 @@ get_index_list(const char *dbname, bool first_db_with_amcheck,
473475
"LEFT JOIN pg_catalog.pg_class cls ON idx.indexrelid=cls.oid "
474476
"LEFT JOIN pg_catalog.pg_namespace nmspc ON cls.relnamespace=nmspc.oid "
475477
"LEFT JOIN pg_catalog.pg_am am ON cls.relam=am.oid "
476-
"WHERE am.amname='btree' AND cls.relpersistence != 't' AND "
477-
"(cls.reltablespace IN "
478+
"WHERE am.amname='btree' "
479+
"AND cls.relpersistence != 't' "
480+
"AND cls.relkind != 'I' "
481+
"AND (cls.reltablespace IN "
478482
"(SELECT oid from pg_catalog.pg_tablespace where spcname <> 'pg_global') "
479483
"OR cls.reltablespace = 0) "
480484
"ORDER BY nmspc.nspname DESC",

tests/checkdb.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ def test_checkdb_amcheck_only_sanity(self):
3636
node.safe_psql(
3737
"postgres",
3838
"create index on t_heap(id)")
39+
40+
node.safe_psql(
41+
"postgres",
42+
"create table idxpart (a int) "
43+
"partition by range (a)")
44+
45+
node.safe_psql(
46+
"postgres",
47+
"create index on idxpart(a)")
3948

4049
try:
4150
node.safe_psql(

0 commit comments

Comments
 (0)