Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed02b35

Browse files
Merge pull request #556 from postgrespro/PBCKP-120
[PBCKP-120] skip partitioned indexes for checkdb --amcheck
2 parents 4728756 + 0b8cf41 commit ed02b35

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/checkdb.c

+7-3
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

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ def test_checkdb_amcheck_only_sanity(self):
3838
node.safe_psql(
3939
"postgres",
4040
"create index on t_heap(id)")
41+
42+
node.safe_psql(
43+
"postgres",
44+
"create table idxpart (a int) "
45+
"partition by range (a)")
46+
47+
node.safe_psql(
48+
"postgres",
49+
"create index on idxpart(a)")
4150

4251
try:
4352
node.safe_psql(

0 commit comments

Comments
 (0)