pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
Cc: Hitoshi Harada <umi.tanuki@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6172: DROP EXTENSION error without CASCADE
Date: Mon, 22 Aug 2011 10:39:00 -0400
Message-ID: <3820.1314023940@sss.pgh.pa.us> (raw)
In-Reply-To: <878vqla87u.fsf@hi-media-techno.com>
References: <201108211644.p7LGibJ1064013@wwwmaster.postgresql.org>
	<m2wre6v9z8.fsf@2ndQuadrant.fr>
	<m2aab2v6wq.fsf@2ndQuadrant.fr>
	<10160.1313967820@sss.pgh.pa.us>
	<878vqla87u.fsf@hi-media-techno.com>

Dimitri Fontaine <dimitri@2ndQuadrant.fr> 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



view thread (8+ messages)  latest in thread

Message-ID: <3820.1314023940@sss.pgh.pa.us>
Permalink:  ../3820.1314023940@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3820.1314023940@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dimitri@2ndQuadrant.fr, umi.tanuki@gmail.com
  Subject: Re: BUG #6172: DROP EXTENSION error without CASCADE
  In-Reply-To: <3820.1314023940@sss.pgh.pa.us>
  References: <201108211644.p7LGibJ1064013@wwwmaster.postgresql.org> <m2wre6v9z8.fsf@2ndQuadrant.fr> <m2aab2v6wq.fsf@2ndQuadrant.fr> <10160.1313967820@sss.pgh.pa.us> <878vqla87u.fsf@hi-media-techno.com> <3820.1314023940@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox