Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z88nj-0006Nj-Qi for pgsql-admin@arkaria.postgresql.org; Thu, 25 Jun 2015 15:10:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z88nj-0003Vw-7S for pgsql-admin@arkaria.postgresql.org; Thu, 25 Jun 2015 15:10:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z88nh-0003VX-MQ for pgsql-admin@postgresql.org; Thu, 25 Jun 2015 15:10:49 +0000 Received: from smtp-auth.no-ip.com ([8.23.224.61] helo=out.smtp-auth.no-ip.com) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z88na-0005zG-IS for pgsql-admin@postgresql.org; Thu, 25 Jun 2015 15:10:48 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [186.11.231.68]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id ED932400CB6; Thu, 25 Jun 2015 08:10:37 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 8288916FE; Thu, 25 Jun 2015 12:10:35 -0300 (CLT) Date: Thu, 25 Jun 2015 12:10:35 -0300 From: Alvaro Herrera To: John Scalia Cc: "David G. Johnston" , "pgsql-admin@postgresql.org" Subject: Re: Trying to change the owner of some tables Message-ID: <20150625151035.GJ3289@postgresql.org> References: <558B6B19.1050305@gmail.com> <558B7893.5000407@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <558B7893.5000407@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org John Scalia wrote: > Thanks guys, I was not aware of that command, but it did NOT succeed in changing these strangely missing tables. The tables appear, when I try to drop the old owner as: > > second_schema.partition_table_name_one; > > then two, three, etc., I've only been successful using > > alter table second_schema.partition_table_name_one owner to userB; > > But I'd rather not do that for 2000+ entries. I think the current situation is that the pg_class entries point to one user, but the pg_shdepend entries point to the original owner. That is an example case of catalog "corruption" -- or rather inconsistency. I think what you should do is update pg_class back to the original state, and then apply REASSIGN OWNED BY. If the new owner had tables other than those owned by the one you're trying to delete, this would be pretty complicated, though -- in this case you should probably compare the pg_shdepend entries to find out which tables were owned by the other user, so that you know which ones to update. This should doable, if a bit tricky. Hopefully this episode demonstrates the folly of updating catalogs "by hand". I suggest never to do that again, and if somebody else tells you to, point them here. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin