Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cdHFa-0007Dk-9l for pgsql-general@arkaria.postgresql.org; Mon, 13 Feb 2017 14:05:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cdHFZ-0003ys-T3 for pgsql-general@arkaria.postgresql.org; Mon, 13 Feb 2017 14:05:05 +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_2) (envelope-from ) id 1cdHDG-00015O-1W for pgsql-general@postgresql.org; Mon, 13 Feb 2017 14:02:42 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cdHDD-0004fj-BD for pgsql-general@postgresql.org; Mon, 13 Feb 2017 14:02:40 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id E12CF5F794; Mon, 13 Feb 2017 09:02:07 -0500 (EST) Date: Mon, 13 Feb 2017 09:02:07 -0500 From: Stephen Frost To: Tom Lane Cc: Frank van Vugt , pgsql-general@postgresql.org Subject: Re: intentional or oversight? pg_dump -c does not restore default priviliges on schema public Message-ID: <20170213140207.GH9812@tamriel.snowman.net> References: <3534542.o3cNaKiDID@techfox> <20170211220617.GG9812@tamriel.snowman.net> <3026.1486855735@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0yIEv4ciajEKQOWx" Content-Disposition: inline In-Reply-To: <3026.1486855735@sss.pgh.pa.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-91-generic (x86_64) X-Uptime: 11:16:11 up 218 days, 17:40, 11 users, load average: 0.03, 0.04, 0.05 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --0yIEv4ciajEKQOWx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tom Lane (tgl@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > I'm not seeing a very simple answer for this, unfortunately. >=20 > I'm inclined to argue that it was a mistake to include any non-pinned > objects in pg_init_privs. The reason initdb leaves some objects unpinned > is exactly because they can be dropped and recreated, and that means > that their "initial" privileges are not static system properties. >=20 > We might need to fix pg_dump too, but I think these entries in > pg_init_privs should simply not be there. Wouldn't that mean we then need to drop and recreate all of those non-pinned objects, with their ACLs, on a -c? Or are you thinking we would just dump out whatever ACLs they have that are different from default object creation, meaning that we'd have ACLs for nearly all the views in pg_catalog and information_schema included in regular pg_dump output? Just dumping out the ACLs wouldn't necessairly get us back to the same state as the database which was dumped out though as the existing objects might already have some GRANTs performed on them. pg_init_privs also handles the initial privileges for extension objects, though I'm guessing you aren't including those. The initdb-time objects are certainly similar though, in some ways, to extensions, the main difference being that you can't really drop/recreate all of the initdb time objects. It seems to me that the oddball here is the public schema, and specifically, the public schema when the user has been using the =66rom-initdb public schema (which has initdb-time privileges which are recorded into pg_init_privs). Had the user dropped and recreated the public schema, the initdb-time privs for the original public schema in pg_init_privs would have been removed, and the new public schema wouldn't have had any entries in pg_init_privs. The reason it's an oddball is that it's the only from-initdb time object which is dropped and recreated as part of pg_dump -c. If we dropped all non-pinned objects and recreated them when running pg_dump -c then perhaps what you're suggesting would work, but we don't and I don't think that's really what you were thinking we would do. While it's a bit grotty, I tend to think the best approach is to continue to assume that the only from-initdb-time object that the user actually wants us to drop/recreate on a pg_dump -c is the public schema, which means we need to handle things a bit differently when working in -c mode for the public schema when pulling ACLs. Thanks! Stephen --0yIEv4ciajEKQOWx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJYobxfAAoJEO1sijiDR2RVwy8P/in5dBhqtDWgVeMy+b8UAYPd p400679YIZnD8G7xQBllTQFXuwJ3pwI6279xd1N1EYRS+9LSlLHDMzJZX8KfasmD +1HfSyjlVwphMHJm+LS4lUgscTl9AxXS6u4Mcg/u1bYqqxTR27/7QC/qGG9X0KAo Ya6ntdrfwRKwoi1fh4YWMhJLcym1va3DacLgAoQVyRCeR8q3pf/KTIiY5TvhqKEw 1Tf13RZZgO5cbDTBErCriyqQIFGrOJq9qscTwzrf0Ll1eBR6vW/lb08hI7GzhuZp cJ12BwzyXe+HvLkN+K/g7YR111dSVxdalielqt88viE+FznsfQsWdzBGVwJu9bC5 iHdRyNzi9wTnFJ381Nx5O13Ffqo4cm4/shlgWibkhHWe4Pq6WQX03lMPDmADGkSV 5jrbyYU+tcooLj5B1pO/7svZ081DkiHABLtI80Kz8WO5v9JG324H/xSLqr7GqxzY gbkDPEHMrxNZRekzynTZmZ7WHahLPx1fZlaWs5aFqezWWTq2RWJn0HbyezhPavqI DJCvZSf5eUUqD5oAqxdN7mlNvonm2nXigBZcJ/CGFqW/MxYu8dyP4+UezBCfZ9K/ Qo9maqZgsmuJGNL4zhPAnE9UmzLYKnwXIgWW0ZS4CzurRywid4E5UX3z1NHebcVF PaAaZEkHM1PqRwz8PDoq =zT8k -----END PGP SIGNATURE----- --0yIEv4ciajEKQOWx--