Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a1M44-0004S8-RM for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Nov 2015 22:27:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a1M43-0000gs-VA for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Nov 2015 22:27:56 +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 1a1M42-0000g2-Rg for pgsql-bugs@postgresql.org; Tue, 24 Nov 2015 22:27:54 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1a1M3z-0005nv-Ll for pgsql-bugs@postgresql.org; Tue, 24 Nov 2015 22:27:53 +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 [200.104.53.52]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 6ABA8400890; Tue, 24 Nov 2015 14:27:50 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id A41AA10C1; Tue, 24 Nov 2015 19:27:48 -0300 (CLT) Date: Tue, 24 Nov 2015 19:27:48 -0300 From: Alvaro Herrera To: Tom Lane Cc: xelah-postgresql@xelah.com, pgsql-bugs@postgresql.org Subject: Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres Message-ID: <20151124222748.GK4073@alvherre.pgsql> References: <20151124121258.435.64678@wrigleys.postgresql.org> <32252.1448402726@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <32252.1448402726@sss.pgh.pa.us> 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-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Tom Lane wrote: > xelah-postgresql@xelah.com writes: > > 'CREATE DATABASE .. OWNER ..' creates a database owned by the correct user, > > but containing a schema apparently owned by the user running 'CREATE > > DATABASE'. This causes us a problem when our test code tries to 'DROP SCHEMA > > public CASCADE' (as a way of clearing the database) as the database owner. > > Yes, the public schema remains owned by the bootstrap superuser. That's > intentional. If you don't want to have that schema, you can drop it, > but you need superuser privileges to do so. We've gotten complaints about it over the years -- this is mostly fallout caused by introduction of schemas, rather than explicitely designed behavior. (Before schemas, the database resulting out of copying the template would be completely empty of objects.) As I remember, Fabien Coelho tried to fix it (many years ago) by having CREATE DATABASE connect to the newly created database and issue a few ALTER commands, but there's no real convenient way to do that. IMO down the road this is something we need to fix. What we have now is not ideal. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs