From: Tom Lane Date: Wed, 20 Feb 2008 17:44:14 +0000 (+0000) Subject: Put a CHECK_FOR_INTERRUPTS call into the loops that try to find a unique new X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=5864345b6d953b724158102405e619ebda57ea5a;p=users%2Fbernd%2Fpostgres.git Put a CHECK_FOR_INTERRUPTS call into the loops that try to find a unique new OID or new relfilenode. If the existing OIDs are sufficiently densely populated, this could take a long time (perhaps even be an infinite loop), so it seems wise to allow the system to respond to a cancel interrupt here. Per a gripe from Jacky Leng. Backpatch as far as 8.1. Older versions just fail on OID collision, instead of looping. --- diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index f584d37ac7..8acc0013fb 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -374,6 +374,8 @@ GetNewOidWithIndex(Relation relation, Relation indexrel) /* Generate new OIDs until we find one not in the table */ do { + CHECK_FOR_INTERRUPTS(); + newOid = GetNewObjectId(); ScanKeyInit(&key, @@ -423,6 +425,8 @@ GetNewRelFileNode(Oid reltablespace, bool relisshared, Relation pg_class) do { + CHECK_FOR_INTERRUPTS(); + /* Generate the OID */ if (pg_class) rnode.relNode = GetNewOid(pg_class);