mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +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:
@ -128,6 +128,14 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot cluster temporary tables of other sessions")));
|
||||
|
||||
/*
|
||||
* Reject clustering a partitioned table.
|
||||
*/
|
||||
if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot cluster a partitioned table")));
|
||||
|
||||
if (stmt->indexname == NULL)
|
||||
{
|
||||
ListCell *index;
|
||||
@ -482,6 +490,12 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
|
||||
Relation pg_index;
|
||||
ListCell *index;
|
||||
|
||||
/* Disallow applying to a partitioned table */
|
||||
if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot mark index clustered in partitioned table")));
|
||||
|
||||
/*
|
||||
* If the index is already marked clustered, no need to do anything.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user