From afc7e0ad556a4f720c466cb4815fc77d310fc50a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 1 Sep 2020 13:40:43 -0400 Subject: Raise error on concurrent drop of partitioned index We were already raising an error for DROP INDEX CONCURRENTLY on a partitioned table, albeit a different and confusing one: ERROR: DROP INDEX CONCURRENTLY must be first action in transaction Change that to throw a more comprehensible error: ERROR: cannot drop partitioned index \"%s\" concurrently Michael Paquier authored the test case for indexes on temporary partitioned tables. Backpatch to 11, where indexes on partitioned tables were added. Reported-by: Jan Mussler Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/16594-d2956ca909585067@postgresql.org --- src/backend/commands/tablecmds.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index d2b15a3387b..3e57c7f9e1d 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -1373,6 +1373,17 @@ RemoveRelations(DropStmt *drop) flags |= PERFORM_DELETION_CONCURRENTLY; } + /* + * Concurrent index drop cannot be used with partitioned indexes, + * either. + */ + if ((flags & PERFORM_DELETION_CONCURRENTLY) != 0 && + get_rel_relkind(relOid) == RELKIND_PARTITIONED_INDEX) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot drop partitioned index \"%s\" concurrently", + rel->relname))); + /* OK, we're ready to delete this one */ obj.classId = RelationRelationId; obj.objectId = relOid; -- cgit v1.2.3