Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgZa1-000145-Fb for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Sep 2016 15:43:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bgZa0-0004pm-Pv for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Sep 2016 15:43:32 +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 1bgZYc-0003Dd-Vh for pgsql-hackers@postgresql.org; Sun, 04 Sep 2016 15:42:07 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgZYV-0004p5-Nq for pgsql-hackers@postgresql.org; Sun, 04 Sep 2016 15:42:05 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id E32D55F794; Sun, 4 Sep 2016 11:41:58 -0400 (EDT) Date: Sun, 4 Sep 2016 11:41:58 -0400 From: Stephen Frost To: Peter Eisentraut Cc: "pgsql-hackers@postgresql.org" Subject: Re: Remove superuser() checks from pgstattuple Message-ID: <20160904154158.GN4028@tamriel.snowman.net> References: <20160823212243.GJ4028@tamriel.snowman.net> <6e01d90c-337f-fc02-2021-6520b4a099b9@2ndquadrant.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pLeP/S9JOHVVfZZr" Content-Disposition: inline In-Reply-To: <6e01d90c-337f-fc02-2021-6520b4a099b9@2ndquadrant.com> 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:03:02 up 57 days, 16:27, 10 users, load average: 0.05, 0.10, 0.08 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --pLeP/S9JOHVVfZZr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Peter Eisentraut (peter.eisentraut@2ndquadrant.com) wrote: > On 8/23/16 5:22 PM, Stephen Frost wrote: > > Now that we track initial privileges on extension objects and changes to > > those permissions, we can drop the superuser() checks from the various > > functions which are part of the pgstattuple extension. > >=20 > > Since a pg_upgrade will preserve the version of the extension which > > existed prior to the upgrade, we can't simply modify the existing > > functions but instead need to create new functions which remove the > > checks and update the SQL-level functions to use the new functions >=20 > I think this is a good change to pursue, and we'll likely want to do > more similar changes in contrib. But I'm worried that what is logically > a 10-line change will end up a 20 KiB patch every time. This is primairly due to how we handle new versions of an extension. Any change to an extension is going to involve a new upgrade script and the removal of the prior version install script and addition of the new version install scripts. > Have we explored other options for addressing the upgrade problems? We did discuss the upgrade issue and Noah proposed the current approach, which appears to be the best option. > Maybe the function could check that non-default privileges have been > granted? Simply changing the function to behave differently depending on what privileges have or havn't been granted doesn't seem like a very good idea. Consider an existing installation where the admin tried to grant access to one of these functions: GRANT EXECUTE ON pgstattuple_func() TO bob; This would result in a GRANT to bob explicitly, and the GRANT to public would still be there also. Then an upgrade of PG, without upgrading the extension, would lead to any user being able to execute the function. An upgrade of the extension would revoke the GRANT to PUBLIC and, further, would hopefuflly cause the admin to consider checking the documentation about the upgrade (which needs to be added; I'll do that). We also created a new version to add the PARALLEL SAFE markings to the functions. In general, I believe it's better to use a new version when we're making these kinds of changes. Thanks! Stephen --pLeP/S9JOHVVfZZr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXzEDGAAoJEO1sijiDR2RVmQsQALDbXuFPqWri/dQ+oMC0eB8k 4mk4g9XMdw1X1HTopRnMqs1BHx4VE7weO92CRSyztibGZc7ZDAWTirJ2nzVYXT7P 8PyZc0mt0zKMm7cKqo0WIrhtdEVd6JdTDpgF8bmL+bWC8Tdof+sgCUvn8pSmj1Ah iBiy2+HK97c/11MBfxa0MQzQOIW3IvEt8zDyQCkco/IuyYv5DGwidFvlV2dVQHCk O+M/diqVwEI1esGvbgJ2nvFY8+ogLzZkIPzxmnNoLHm7o5vdGbN9WTU6sXHt4HeC 1+x4X8aPaVMvt91+EEGEw3alQR1wj6jgA+G933AcGXU4y1Ay8AucLlYBbJdNgr40 ntcaUWQQNP1P8T2XSU0BXPlHnkn6PUyMuhwTY9W0g+KX9s6/Fz1l3hRH1pUa67J6 RoiV1nmqQuuXWt+h75OQT8ZT6aK/qyTxG4Kx2Te9EPLxDgUcq2NhqqGLJ7ioyVXY M130kPg0c/sFzJE82tamkWi9iuVChMfb/R++PMfm0n/LIhmthVQ/RjhsTCgnlrE8 CZPEP+c1J+7UQajcY2XQBNIDqFpgSFBtnRMHl+MLuMPvwomkUJckGHKAoOB0OB51 WgnuUj6ZaXfwRYT9IvyCCNhlViLlCPAxlFCwGz/6NtCC9rGDYi3EN9cT56od9r/L fyQv+dRYum9Hsh2qa5De =gbCI -----END PGP SIGNATURE----- --pLeP/S9JOHVVfZZr--