Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T7Z74-0001gn-IT for pgsql-bugs@postgresql.org; Fri, 31 Aug 2012 21:50:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T7Z72-0001dQ-Ad for pgsql-bugs@postgresql.org; Fri, 31 Aug 2012 21:50:49 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q7VLofka022748; Fri, 31 Aug 2012 17:50:42 -0400 (EDT) From: Tom Lane To: Alvaro Herrera cc: jeff , Pg Bugs Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations In-reply-to: <1346445756-sup-1463@alvh.no-ip.org> References: <26225.1340419030@sss.pgh.pa.us> <1346425015-sup-3266@alvh.no-ip.org> <29703.1346429879@sss.pgh.pa.us> <1346430351-sup-5026@alvh.no-ip.org> <1346439762-sup-9541@alvh.no-ip.org> <18412.1346443263@sss.pgh.pa.us> <1346444697-sup-476@alvh.no-ip.org> <1346445756-sup-1463@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Fri, 31 Aug 2012 17:00:52 -0400" Date: Fri, 31 Aug 2012 17:50:41 -0400 Message-ID: <22747.1346449841@sss.pgh.pa.us> X-Pg-Spam-Score: -2.1 (--) X-Archive-Number: 201208/271 X-Sequence-Number: 33995 Alvaro Herrera writes: > Excerpts from Alvaro Herrera's message of vie ago 31 16:25:40 -0400 2012: >> This doesn't actually work though: it's trying to move sequences twice. >> Not sure what the right fix for this is ... still looking. > Besides being listed with deptype=extension for the extension in > question, the sequence has a deptype=auto entry for the column, which > leads to it being moved twice. Ah so. > 2. During ALTER EXTENSION execution, skip moving objects that have > already been moved. Not really sure how this would be implemented; +1 for this approach. I'm a bit surprised we didn't hit this before, because in general there can be multiple dependency chains leading from object A to object B. Most code that is doing more than trivial dependency-walking has to be prepared to cope with reaching the same object multiple times. Implementation like this seems reasonable: > 4. Maybe we could have AlterRelationNamespaceInternal check what the > current namespace is for the object, and do nothing if it's already the > target namespace. We already have some such shortcut for ALTER OWNER, IIRC, so why not for SET SCHEMA as well? I suspect that AlterRelationNamespaceInternal is not the only function that needs it, too. regards, tom lane