Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 0B5A4B5DC69 for ; Sun, 21 Aug 2011 16:42:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 37360-01-3 for ; Sun, 21 Aug 2011 19:41:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from acidenitrix.villemain.org (acidenitrix.villemain.org [91.121.90.165]) by mail.postgresql.org (Postfix) with ESMTP id 6456CB5DC9D for ; Sun, 21 Aug 2011 16:30:12 -0300 (ADT) Received: from [89.157.192.174] (helo=DimIMac.local) by acidenitrix.villemain.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QvDil-0005zh-Fb; Sun, 21 Aug 2011 21:30:11 +0200 Received: by DimIMac.local (Postfix, from userid 501) id 1C977271B6E8; Sun, 21 Aug 2011 21:30:04 +0200 (CEST) From: Dimitri Fontaine To: "Hitoshi Harada" Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6172: DROP EXTENSION error without CASCADE Organization: 2ndQuadrant References: <201108211644.p7LGibJ1064013@wwwmaster.postgresql.org> User-Mail-Address: dimitri@2ndQuadrant.fr Date: Sun, 21 Aug 2011 21:30:03 +0200 In-Reply-To: <201108211644.p7LGibJ1064013@wwwmaster.postgresql.org> (Hitoshi Harada's message of "Sun, 21 Aug 2011 16:44:37 GMT") Message-ID: User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201108/123 X-Sequence-Number: 30935 "Hitoshi Harada" writes: > On pure-installed RC1 database, you can CREATE EXTENSION, but cannot DROP > it. > > CREATE EXTENSION cube; > DROP EXTENSION cube; > > ERROR: cannot drop extension cube because other objects depend on it I confirm I have the same bug in current HEAD. Reading the code, my gut feeling is that the bug sits in findDependentObjects(), in this part of it: /* * Okay, recurse to the other object instead of proceeding. We * treat this exactly as if the original reference had linked * to that object instead of this one; hence, pass through the * same flags and stack. */ The extension cube depends on some operator that depend on some function implementing them, and as the initial dependency delete call is not explicitly mentioning them, then it behaves as if CASCADE was needed. Also, \dx+ cube will not show all the operators and functions. It skips those that we see in the CASCADE error message listing. Here's the SQL query that will list the object with a direct extension dependency towards the extension, here of OID 16385. dim=3D# SELECT pg_catalog.pg_describe_object(classid, objid, 0) AS "Object = Description" dim-# FROM pg_catalog.pg_depend dim-# WHERE refclassid =3D 'pg_catalog.pg_extension'::pg_catalog.regclass A= ND refobjid =3D '16385' AND deptype =3D 'e' dim-# ORDER BY 1; Of course we didn't have that problem when we added extensions in (that I remember of), so I'm now going to try and find when that did change=E2=80= =A6 Regards, --=20 Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support