1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Fix assertion failure with ALTER TABLE ATTACH PARTITION and indexes

Using ALTER TABLE ATTACH PARTITION causes an assertion failure when
attempting to work on a partitioned index, because partitioned indexes
cannot have partition bounds.

The grammar of ALTER TABLE ATTACH PARTITION requires partition bounds,
but not ALTER INDEX, so mixing ALTER TABLE with partitioned indexes is
confusing.  Hence, on HEAD, prevent ALTER TABLE to attach a partition if
the relation involved is a partitioned index.  On back-branches, as
applications may rely on the existing behavior, just remove the
culprit assertion.

Reported-by: Alexander Lakhin
Author: Amit Langote, Michael Paquier
Discussion: https://postgr.es/m/16276-5cd1dcc8fb8be7b5@postgresql.org
Backpatch-through: 11
This commit is contained in:
Michael Paquier
2020-03-03 13:56:11 +09:00
parent f22feedc25
commit dc8364824f
3 changed files with 26 additions and 1 deletions

View File

@ -3685,7 +3685,6 @@ transformPartitionCmd(CreateStmtContext *cxt, PartitionCmd *cmd)
break;
case RELKIND_PARTITIONED_INDEX:
/* nothing to check */
Assert(cmd->bound == NULL);
break;
case RELKIND_RELATION:
/* the table must be partitioned */