Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mk8Mg-0006Tt-C2 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Nov 2021 17:23:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mk8Mf-0004eF-C2 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Nov 2021 17:23:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mk8Mf-0004e5-2g for pgsql-hackers@lists.postgresql.org; Mon, 08 Nov 2021 17:23:25 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mk8Mb-0003cW-LM for pgsql-hackers@postgresql.org; Mon, 08 Nov 2021 17:23:24 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id E0B455F7A2; Mon, 8 Nov 2021 12:23:18 -0500 (EST) Date: Mon, 8 Nov 2021 12:23:18 -0500 From: Stephen Frost To: Andres Freund Cc: Robert Haas , Jeff Davis , "Bossart, Nathan" , Alvaro Herrera , Bharath Rupireddy , PostgreSQL-development Subject: Re: Predefined role pg_maintenance for VACUUM, ANALYZE, CHECKPOINT. Message-ID: <20211108172318.GF20998@tamriel.snowman.net> References: <2f6c033019c3a1ec499b516e3e54022b7bcdb58a.camel@j-davis.com> <202110310026.zmhkxct6ka6c@alvherre.pgsql> <6498F6FC-714B-4AC2-B0E1-9A5321654277@amazon.com> <20211101165025.GS20998@tamriel.snowman.net> <5e7a618de1b49ba1ceede54ee1b1d073bd57f1f4.camel@j-davis.com> <20211104224204.ee5673h3qlzblh7e@alap3.anarazel.de> <20211107184649.mpncdezkzfq2v4pb@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+10PrBpSX62Koh6T" Content-Disposition: inline In-Reply-To: <20211107184649.mpncdezkzfq2v4pb@alap3.anarazel.de> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --+10PrBpSX62Koh6T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Andres Freund (andres@anarazel.de) wrote: > On 2021-11-05 08:42:58 -0400, Robert Haas wrote: > > On Thu, Nov 4, 2021 at 7:38 PM Jeff Davis wrote: > > > It seems like this specific approach has been mostly shot down alread= y. > > > But out of curiosity, are you intending to run CHECKPOINT during > > > bootstrap or something? > >=20 > > Imagine a system with corruption in pg_proc. Right now, that won't > > prevent you from successfully executing a checkpoint. With this > > approach, it might. >=20 > Exactly. It wouldn't matter if checkpoints weren't something needed to > potentially bring the system back into a sane state, but ... This really isn't that hard to address- do a superuser check, if it passes then just call the checkpoint function like CHECKPOINT; does today. Otherwise, check the perms on the function or just call the function in a manner which would check privileges, or maybe have another predefined role, though I continue to feel like the function based approach is better. If we're actually worried about catalog corruption (and, frankly, I've got some serious doubts that jumping in and running CHECKPOINT; by hand is a great idea if there's such active corruption) then we must use such an approach no matter how we allow non-superusers to run the command because any approach to that necessarily involves some amount of catalog access. Any concern leveraged against pg_proc applies equally to pg_auth_members after all, so having it be something role-based vs. function privilege is really just moving deck chairs around on the titanic at that point. Thanks, Stephen --+10PrBpSX62Koh6T Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJhiV0GAAoJEO1sijiDR2RV7b4QAMYMJLzXaYs68mJE333Ajt2H LKQep9Awumt18Hz1GYmzyu/O7wFeeHb3m4TV2fU8rK1q3tHRQzc8VJdS6rBRKc8D xFgMJH+PHuVDq+AGioV0r2iFGTl9xTmgLBUX6zHSq04livAkzo2fPozuO5TCJNB1 XC4vf74bJxBuOL7w925iKcm4ra1YSiNcUaEGjOBYyu82GrNNgKkhj4YXfil3iiNg K7OvM9VdtkWsroWbKowHB8FQ6JNZ5p2fpMRYnewXLSo0gVAOxTUUhdZYO0244U92 uhkAYQLxzMF8y6u34gyeyqcPneNJkwKk35pHFJzp+MB5D0dZ2Nli4+jcVApeFuhh +2WeiU+PBpC4NyR9hVrVPZf+rEWX6p0PVu8/Xb4bAb0AdjoC3EHtXAmE8YBG4WD8 PXvaESfp/7YkX4pd9ACZGZVGd8SVfsTrnBcKsQ74GI7pkaJGzfBq1hVleL3BEW3y ih9Z40YLdUKP9CzzhisQv99/1o7KNghVw4AQBXXtqCfnCkYk4+pIQsvO3yPk3XbX CzVlgEl68/SGRWOgI+Ks9NlkbdGyTgv4m9Va08kvXd9K1n+lWI+xAtBQwU3uuFmG 0pBVjwgz2vHmt781GyXjV2SA9XVsIjJbNr1v/VNTNXO4uB70SF9k3ZYv1jIA4NfH yd851FjNnEb6EQeJiK73 =Wezq -----END PGP SIGNATURE----- --+10PrBpSX62Koh6T--