mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Back-patch the 8.3 fix that prohibits TRUNCATE, CLUSTER, and REINDEX when the
current transaction has any open references to the target relation or index (implying it has an active query using the relation). Also back-patch the 8.2 fix that prohibits TRUNCATE and CLUSTER when there are pending AFTER-trigger events. Per suggestion from Heikki.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.131.4.2 2007/09/12 15:16:23 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.131.4.3 2008/05/27 21:13:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -405,6 +405,12 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid)
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot cluster temporary tables of other sessions")));
|
||||
|
||||
/*
|
||||
* Also check for active uses of the relation in the current transaction,
|
||||
* including open scans and pending AFTER trigger events.
|
||||
*/
|
||||
CheckTableNotInUse(OldHeap, "CLUSTER");
|
||||
|
||||
/* Drop relcache refcnt on OldIndex, but keep lock */
|
||||
index_close(OldIndex);
|
||||
}
|
||||
|
Reference in New Issue
Block a user