diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/catalog/heap.c | 10 | ||||
-rw-r--r-- | src/backend/catalog/index.c | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 2cf210d82c2..bfffd6ef4c7 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -1603,14 +1603,10 @@ heap_drop_with_catalog(Oid relid) /* * There can no longer be anyone *else* touching the relation, but we - * might still have open queries or cursors in our own session. + * might still have open queries or cursors, or pending trigger events, + * in our own session. */ - if (rel->rd_refcnt != 1) - ereport(ERROR, - (errcode(ERRCODE_OBJECT_IN_USE), - errmsg("cannot drop \"%s\" because " - "it is being used by active queries in this session", - RelationGetRelationName(rel)))); + CheckTableNotInUse(rel, "DROP TABLE"); /* * Delete pg_foreign_table tuple first. diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 5979a650921..58265129e60 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -1299,6 +1299,12 @@ index_drop(Oid indexId) userIndexRelation = index_open(indexId, AccessExclusiveLock); /* + * There can no longer be anyone *else* touching the index, but we + * might still have open queries using it in our own session. + */ + CheckTableNotInUse(userIndexRelation, "DROP INDEX"); + + /* * Schedule physical removal of the files */ RelationDropStorage(userIndexRelation); |