Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C3663B5DC0C for ; Mon, 22 Aug 2011 11:39:11 -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 41791-08 for ; Mon, 22 Aug 2011 14:39:05 +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 E6273B5DBE9 for ; Mon, 22 Aug 2011 11:39:04 -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 p7MEd0T8003821; Mon, 22 Aug 2011 10:39:00 -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 10:39:00 -0400 Message-ID: <3820.1314023940@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/137 X-Sequence-Number: 30949 Dimitri Fontaine writes: > ... My fix is > to have deleteDependencyRecordsFor use true for skipExtensionDeps. On further reflection, there's some merit in that fix too. The question is what do we think should happen if the pre-existing shell operator belongs to another extension. It seems like the reasonable alternatives are (1) delete those pg_depend entries and allow the current extension to take ownership. (2) throw an error. What you suggest above would result in (2), whereas what I was thinking of would result in (1). The case where this would actually happen is where extension A creates some operator, and mentions some other operator as its commutator or negator, but never gets around to defining the other operator. Then extension B comes along and tries to fill in the other operator definition. Do we want to let that happen, or do we want to throw an error on the grounds that this sort of interconnection of two extensions was almost certainly not intended? (Note that I rather doubt that dropping either extension alone, afterwards, would clean up nicely, since we have no code that would remove the oprcom/oprnegate linkage.) A completely different line of thought is that maybe extension membership records shouldn't be created at all for a shell operator, on the grounds that it's not a real object but only a placeholder until it's filled in. One somewhat analogous situation is where we create a shell type and then fill it in later. That code uses skipExtensionDeps = true and so will end up throwing an error if the pre-existing membership is for another extension. However, it's pretty hard to imagine a useful situation where an extension would create a shell type and not fill it in, so I'm not sure that this is a close analogy. On the whole I'm starting to think that throwing an error is the best thing. We could always relax that later, but going the other way might be problematic. regards, tom lane