Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A7A73B5DBDA for ; Mon, 22 Aug 2011 10:52:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 25339-05 for ; Mon, 22 Aug 2011 13:52:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 33F75B5DBD8 for ; Mon, 22 Aug 2011 10:52:42 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p7MDqeXJ003116; Mon, 22 Aug 2011 09:52:40 -0400 (EDT) To: Dimitri Fontaine cc: "Hitoshi Harada" , pgsql-bugs@postgresql.org Subject: Re: BUG #6172: DROP EXTENSION error without CASCADE In-reply-to: <878vqla87u.fsf@hi-media-techno.com> References: <201108211644.p7LGibJ1064013@wwwmaster.postgresql.org> <10160.1313967820@sss.pgh.pa.us> <878vqla87u.fsf@hi-media-techno.com> Comments: In-reply-to Dimitri Fontaine message dated "Mon, 22 Aug 2011 15:25:57 +0200" Date: Mon, 22 Aug 2011 09:52:40 -0400 Message-ID: <3115.1314021160@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.846 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.946 X-Spam-Level: X-Archive-Number: 201108/134 X-Sequence-Number: 30946 Dimitri Fontaine writes: > But in makeOperatorDependencies() we find the following piece of code: > /* In case we are updating a shell, delete any existing entries */ > deleteDependencyRecordsFor(myself.classId, myself.objectId, false); > false is for bool skipExtensionDeps. > And now at the end of the same function, dependency is recorded back, > except in some case: > oldext = getExtensionOfObject(object->classId, object->objectId); > if (OidIsValid(oldext)) > { > /* If already a member of this extension, nothing to do */ > if (oldext == CurrentExtensionObject) > return; > The problem lies in catalog scans and SnapshotNow, I think. [ light goes on... ] We need a CommandCounterIncrement in there. Else, the code that looks to see if the object is already part of the extension does not see the pg_depend row as deleted (yet). Not sure offhand where the cleanest place to put it is. regards, tom lane