pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
To: Bruce Momjian <bruce@momjian.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: jeff@pgexperts.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations
Date: Wed, 12 Sep 2012 11:51:43 +0200
Message-ID: <m2k3vzwouo.fsf@2ndQuadrant.fr> (raw)
In-Reply-To: <20120830214826.GC32350@momjian.us>
References: <E1SiEL6-0002u2-Ov@wrigleys.postgresql.org>
	<26225.1340419030@sss.pgh.pa.us>
	<20120830214826.GC32350@momjian.us>

Hi,

Sorry for being late at the party… been distracted away…
       
Bruce Momjian <bruce@momjian.us> writes:
> On Fri, Jun 22, 2012 at 10:37:10PM -0400, Tom Lane wrote:
>> jeff@pgexperts.com writes:
>> > DROP and CREATE extension appear to work fine, but if you ALTER EXTENSION
>> > postgis SET SCHEMA foo, it leaves a few relations behind.
>> 
>> What it seems to be leaving behind is indexes ... also relation rowtypes.
>> 
>> A bit of looking shows that ALTER EXTENSION SET SCHEMA calls
>> AlterObjectNamespace_oid on the table.  AlterObjectNamespace_oid
>> calls AlterRelationNamespaceInternal, and nothing else.  In comparison,
>> ALTER TABLE SET SCHEMA (AlterTableNamespace) calls
>> AlterRelationNamespaceInternal and about four other things.  I'm not
>> sure if this was broken before the last round of refactoring in this
>> area, but for sure it's broken now.

Looking at that code, my theory of how we got there is that in the
submitted extension patch I did only use DEPENDENCY_INTERNAL and Tom
introduced the much better DEPENDENCY_EXTENSION tracking. With the
former, indexes and sequences and constraints where found in the
dependency walking code, but only the main relation is now registered in
the later model.

I need to do some testing about dependency tracking on SERIAL generated
sequences compared to manually created sequences in extension scripts, I
think we track sequences directly only in the manual case.

I think we need to share more code in between
AlterRelationNamespaceInternal and AlterTableNamespace, but I'm not sure
if that's not exactly what Álvaro did try with his _oid() attempt that
failed.

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support




view thread (28+ messages)  latest in thread

Message-ID: <m2k3vzwouo.fsf@2ndQuadrant.fr>
Permalink:  ../m2k3vzwouo.fsf@2ndQuadrant.fr/
Also on:    postgresql.org/message-id/m2k3vzwouo.fsf@2ndQuadrant.fr

 · 

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: dimitri@2ndQuadrant.fr, bruce@momjian.us, tgl@sss.pgh.pa.us, jeff@pgexperts.com
  Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations
  In-Reply-To: <m2k3vzwouo.fsf@2ndQuadrant.fr>
  References: <E1SiEL6-0002u2-Ov@wrigleys.postgresql.org> <26225.1340419030@sss.pgh.pa.us> <20120830214826.GC32350@momjian.us> <m2k3vzwouo.fsf@2ndQuadrant.fr>

* 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