1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-01 21:31:19 +03:00

Ignore partitioned indexes where appropriate

get_relation_info() was too optimistic about opening indexes in
partitioned tables, which would raise errors when any queries were
planned on such tables.  Fix by ignoring any indexes of the partitioned
kind.

CLUSTER (and ALTER TABLE CLUSTER ON) had a similar problem.  Fix by
disallowing these commands in partitioned tables.

Fallout from 8b08f7d482.
This commit is contained in:
Alvaro Herrera
2018-01-25 16:11:51 -03:00
parent 5955d93419
commit 05fb5d6619
6 changed files with 58 additions and 0 deletions

View File

@@ -207,6 +207,16 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
continue;
}
/*
* Ignore partitioned indexes, since they are not usable for
* queries.
*/
if (indexRelation->rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
{
index_close(indexRelation, NoLock);
continue;
}
/*
* If the index is valid, but cannot yet be used, ignore it; but
* mark the plan we are generating as transient. See