pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Corey Huinker <corey.huinker@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: predefined role(s) for VACUUM and ANALYZE
Date: Tue, 6 Dec 2022 11:51:08 -0800
Message-ID: <20221206195108.GD3078082@nathanxps13> (raw)
In-Reply-To: <878rjkiwih.fsf@wibble.ilmari.org>
References: <20221114234004.GA1771874@nathanxps13>
	<20221115050813.GA1953731@nathanxps13>
	<287b17b8-92f3-2bc2-6bcf-31dc1305b65a@dunslane.net>
	<20221117043952.GA116054@nathanxps13>
	<20221118170504.GA401589@nathanxps13>
	<20221119185004.GA539143@nathanxps13>
	<20221120165713.GA597801@nathanxps13>
	<0b00a6ff-1475-c0ba-15ec-5b5e381c6359@dunslane.net>
	<20221123235444.GA479104@nathanxps13>
	<878rjkiwih.fsf@wibble.ilmari.org>

On Tue, Dec 06, 2022 at 11:47:50AM +0000, Dagfinn Ilmari Mannsåker wrote:
> These checks are getting rather repetitive, how about a data-driven
> approach, along the lines of the below patch?  I'm not quite happy with
> the naming of the struct and its members (and maybe it should be in a
> header?), suggestions welcome.

+1.  I wonder if we should also consider checking all the bits at once
before we start checking for the predefined roles.  I'm thinking of
something a bit like this:

	role_mask = ACL_SELECT | ACL_INSERT | ACL_UPDATE |
				ACL_DELETE | ACL_VACUUM | ACL_ANALYZE;

	if (mask & role_mask != result & role_mask)
	{
		... existing checks here ...
	}

I'm skeptical this actually produces any measurable benefit, but presumably
the predefined roles list will continue to grow, so maybe it's still worth
adding a fast path.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (63+ messages)

Message-ID: <20221206195108.GD3078082@nathanxps13>
Permalink:  ../20221206195108.GD3078082@nathanxps13/
Also on:    postgresql.org/message-id/20221206195108.GD3078082@nathanxps13

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, ilmari@ilmari.org, andrew@dunslane.net, corey.huinker@gmail.com, tgl@sss.pgh.pa.us, sfrost@snowman.net, bharath.rupireddyforpostgres@gmail.com, david.g.johnston@gmail.com, horikyota.ntt@gmail.com, michael@paquier.xyz, robertmhaas@gmail.com
  Subject: Re: predefined role(s) for VACUUM and ANALYZE
  In-Reply-To: <20221206195108.GD3078082@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox