Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T7T9H-0004MO-Dr for pgsql-bugs@postgresql.org; Fri, 31 Aug 2012 15:28:43 +0000 Received: from smtprelay0243.b.hostedemail.com ([64.98.42.243] helo=smtprelay.b.hostedemail.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T7T9E-0004kh-KF for pgsql-bugs@postgresql.org; Fri, 31 Aug 2012 15:28:42 +0000 Received: from filter.hostedemail.com (b-bigip1 [10.5.19.254]) by smtprelay06.b.hostedemail.com (Postfix) with SMTP id BD0002448C3; Fri, 31 Aug 2012 15:28:39 +0000 (UTC) X-Panda: scanned! X-Spam-Summary: 50, 0, 0, , d41d8cd98f00b204, alvherre@alvh.no-ip.org, :::::, RULES_HIT:152:355:379:599:601:800:945:967:973:988:989:1260:1277:1311:1313:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2379:2393:2525:2553:2560:2563:2682:2685:2857:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3027:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3869:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4605:4659:5007:6261:7679:7809:8660:8957:9025:9121:10004:10400:10848:10967:11256:11257:11658:11914:12043:12296:12438:12517:12519, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Filterd-Recvd-Size: 2269 Received: from perhan.alvh.no-ip.org (unknown [200.85.215.105]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf05.b.hostedemail.com (Postfix) with ESMTPA; Fri, 31 Aug 2012 15:28:39 +0000 (UTC) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 690256E5DD; Fri, 31 Aug 2012 11:28:35 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: jeff , Pg Bugs Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations From: Alvaro Herrera To: Tom Lane In-reply-to: <26225.1340419030@sss.pgh.pa.us> References: <26225.1340419030@sss.pgh.pa.us> Date: Fri, 31 Aug 2012 11:28:35 -0400 Message-Id: <1346425015-sup-3266@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201208/258 X-Sequence-Number: 33982 Excerpts from Tom Lane's message of vie jun 22 22:37:10 -0400 2012: > jeff@pgexperts.com writes: > > DROP and CREATE extension appear to work fine, but if you ALTER EXTEN= SION > > postgis SET SCHEMA foo, it leaves a few relations behind. >=20 > What it seems to be leaving behind is indexes ... also relation rowtype= s. >=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. Aha, I see the bug. It seems the split for AlterObjectNamespace_oid related to tables was done at the wrong level: there should be a new AlterTableNamespace_internal call that does all the extra stuff, and which is to be called from AlterObjectNamespace_oid. FWIW this bug seems to have been introduced in the initial extensions commit, d9572c4e3b474031060189050e14ef384b94e001. Prior to that we had ExecAlterObjectSchemaStmt calling AlterTableNamespace directly. --=20 =C3=81lvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services