Skip to content

[PBCKP-120] skip partitioned indexes for checkdb --amcheck #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/checkdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,9 @@ get_index_list(const char *dbname, bool first_db_with_amcheck,
"LEFT JOIN pg_catalog.pg_class cls ON idx.indexrelid=cls.oid "
"LEFT JOIN pg_catalog.pg_namespace nmspc ON cls.relnamespace=nmspc.oid "
"LEFT JOIN pg_catalog.pg_am am ON cls.relam=am.oid "
"WHERE am.amname='btree' AND cls.relpersistence != 't' "
"WHERE am.amname='btree' "
"AND cls.relpersistence != 't' "
"AND cls.relkind != 'I' "
"ORDER BY nmspc.nspname DESC",
0, NULL);
}
Expand All @@ -473,8 +475,10 @@ get_index_list(const char *dbname, bool first_db_with_amcheck,
"LEFT JOIN pg_catalog.pg_class cls ON idx.indexrelid=cls.oid "
"LEFT JOIN pg_catalog.pg_namespace nmspc ON cls.relnamespace=nmspc.oid "
"LEFT JOIN pg_catalog.pg_am am ON cls.relam=am.oid "
"WHERE am.amname='btree' AND cls.relpersistence != 't' AND "
"(cls.reltablespace IN "
"WHERE am.amname='btree' "
"AND cls.relpersistence != 't' "
"AND cls.relkind != 'I' "
"AND (cls.reltablespace IN "
"(SELECT oid from pg_catalog.pg_tablespace where spcname <> 'pg_global') "
"OR cls.reltablespace = 0) "
"ORDER BY nmspc.nspname DESC",
Expand Down
9 changes: 9 additions & 0 deletions tests/checkdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ def test_checkdb_amcheck_only_sanity(self):
node.safe_psql(
"postgres",
"create index on t_heap(id)")

node.safe_psql(
"postgres",
"create table idxpart (a int) "
"partition by range (a)")

node.safe_psql(
"postgres",
"create index on idxpart(a)")

try:
node.safe_psql(
Expand Down