Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a1Mc3-0006KB-NI for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Nov 2015 23:03:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a1Mc2-00061s-Fw for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Nov 2015 23:03:02 +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 1a1MbO-0004cp-VI for pgsql-bugs@postgresql.org; Tue, 24 Nov 2015 23:02:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a1MbM-0006VB-Nt for pgsql-bugs@postgresql.org; Tue, 24 Nov 2015 23:02:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tAON2GtL001675; Tue, 24 Nov 2015 18:02:16 -0500 From: Tom Lane To: Alvaro Herrera 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 In-reply-to: <20151124222748.GK4073@alvherre.pgsql> References: <20151124121258.435.64678@wrigleys.postgresql.org> <32252.1448402726@sss.pgh.pa.us> <20151124222748.GK4073@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 24 Nov 2015 19:27:48 -0300" Date: Tue, 24 Nov 2015 18:02:16 -0500 Message-ID: <1674.1448406136@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) 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 Alvaro Herrera writes: > Tom Lane wrote: >> 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.) It's far from empty of objects ... that's just the only one that people commonly want to drop. > 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. Perhaps. To my mind the lack of ability to do anything but slavishly duplicate the contents of template1 is just one of the shortcomings of the physical-file-copy-based implementation of CREATE DATABASE. If we were to reimplement that somehow then we might have the option to change the properties of some of the objects. (Admittedly, I have no good ideas as to exactly what a new implementation might look like. But ideally it would capture an MVCC snapshot of the template and not have all the weird restrictions we have now, like having to force a checkpoint.) But anyway, it's behaving as designed, and I would strongly recommend that the OP not hold his breath while waiting for it to change. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs