Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBjc4-0006gO-Lh for pgsql-bugs@postgresql.org; Wed, 12 Sep 2012 09:52:04 +0000 Received: from acidenitrix.villemain.org ([91.121.90.165]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBjc1-0000yN-Hz for pgsql-bugs@postgresql.org; Wed, 12 Sep 2012 09:52:04 +0000 Received: from cac94-7-82-243-26-157.fbx.proxad.net ([82.243.26.157] helo=DimIMac.local) by acidenitrix.villemain.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TBjby-0000RU-RP; Wed, 12 Sep 2012 11:51:59 +0200 From: Dimitri Fontaine To: Bruce Momjian Cc: Tom Lane , jeff@pgexperts.com, pgsql-bugs@postgresql.org Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations Organization: 2ndQuadrant References: <26225.1340419030@sss.pgh.pa.us> <20120830214826.GC32350@momjian.us> User-Mail-Address: dimitri@2ndQuadrant.fr Date: Wed, 12 Sep 2012 11:51:43 +0200 In-Reply-To: <20120830214826.GC32350@momjian.us> (Bruce Momjian's message of "Thu, 30 Aug 2012 17:48:26 -0400") Message-ID: User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/100 X-Sequence-Number: 34095 Hi, Sorry for being late at the party=E2=80=A6 been distracted away=E2=80=A6 =20=20=20=20=20=20=20 Bruce Momjian 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 EXTENS= ION >> > postgis SET SCHEMA foo, it leaves a few relations behind. >>=20 >> What it seems to be leaving behind is indexes ... also relation rowtypes. >>=20 >> 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 =C3=81lvaro did try with his _oid() attempt that failed. Regards, --=20 Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support