Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X461w-0007wa-Im for pgsql-admin@arkaria.postgresql.org; Mon, 07 Jul 2014 10:20:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X461v-0002KX-4Q for pgsql-admin@arkaria.postgresql.org; Mon, 07 Jul 2014 10:20:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X461u-0002Jy-0U for pgsql-admin@postgresql.org; Mon, 07 Jul 2014 10:20:14 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1X461q-0007oA-Ja for pgsql-admin@postgresql.org; Mon, 07 Jul 2014 10:20:12 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X461m-0004aL-Sg for pgsql-admin@postgresql.org; Mon, 07 Jul 2014 12:20:06 +0200 Received: from 217.110.94.121 ([217.110.94.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 07 Jul 2014 12:20:06 +0200 Received: from spam_eater by 217.110.94.121 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 07 Jul 2014 12:20:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Thomas Kellerer Subject: Re: cannot remove schema public Date: Mon, 07 Jul 2014 12:19:55 +0200 Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.121 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: X-Pg-Spam-Score: 0.7 (/) 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 Szymon Guz, 07.07.2014 11:57: > For the schema public I want to remove it and create again. > However that doesn't work, I'm wondering if that's on purpose, or it's a kind of a bug. > > I'm using user 'szymon' in my console. > > Then I created a user: > > create user test password 'test'; > > and database > > create database test owner test; > > I logged into the database as the user: > > test=# \c test test > You are now connected to database "test" as user "test". > > And the owner of the public schema is not test, however it's an owner of the test database. > > test=# \dn > List of schemas > Name | Owner > --------+-------- > public | szymon > (1 row) > > When I try to remove the public schema, then I get: > > test=> drop schema public cascade; > ERROR: must be owner of schema public I noticed that as well recently. I think there is not much you can do apart from changing the ownership of the schema after creating the database. However: I use "drop owned by test" to be better suited to make a clean database for testing purposes. This also means any extension that was installed into the database (and which is not owned by the test user) will survive this as well. -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin