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 1p2dyG-0005sL-Do for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 19:51:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2dyE-0006ir-W8 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 19:51:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2dyE-0006ia-Fz for pgsql-hackers@lists.postgresql.org; Tue, 06 Dec 2022 19:51:14 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p2dyC-0000zT-BG for pgsql-hackers@postgresql.org; Tue, 06 Dec 2022 19:51:13 +0000 Received: by mail-pl1-x632.google.com with SMTP id m4so8046540pls.4 for ; Tue, 06 Dec 2022 11:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=5uVW7RNQ9swDhFSL+9Uzz98qJ8JFEfDDlVGVOq/HzpA=; b=HqZRi8yf7NJJiNsQpbch5a/TDU49XTatMX44ROAvgd2ZwKWkIYiDNs4tr1kB0JyG1Y M00YJE6XyyYaqQM8ndM1TPot7iHiplTEQ7c0nJ+q7wC02VzlpHAxUkVCp5/QR56VnyZk mII55O5z+9oIZc4vCXB7tnfy5aV+4Fik9qo4Inc2Y+mv5c18i3i0sGGnu6NKCoRaJDBv s/rni4paS1uNxu/+JNqhWooJy0ICY3BvmAdXCmab6T5yc5hdXxnDy3dhINf/le5C3g3I qsLsb48qOAzSpt7BseM/oYp04teSsZEr94QNNJHSz5mhmKu2gwHV8TAbfER3sEcWfMrY OUaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5uVW7RNQ9swDhFSL+9Uzz98qJ8JFEfDDlVGVOq/HzpA=; b=fMW09Lj4Haw2/52AWj/nABloGbWwaMUhMZtUiwPzTTA/VWhahualTww0glyLoH4xYu elREEMWqhxFRHMTHXIufxcypsbxMjF2tj2JAQZdLCyfh0nrkK4qU4SYj3Zk5Tcf0JwKY Z2t30PcD1OI6KvRjaKTvCM36yICLZs6OmlE4ogRdXKxe3gWQ3YtM6jHz1J29mkBFmiFl /WklQocpeTxBeBanAlOn1lLsy69TV+++KKYNPqZkzJhNYe/QNG7+3cubG/B0pjZmFpwk cf5LItSSbgGwADQF1KbRc8Uag7Ehtmar650xGUslv+8b9CaG3G+ExIgMkG5b9AsV+DdJ 9+CQ== X-Gm-Message-State: ANoB5pkYbCgeLsbXKZ20zI8kxJOww/XL7Y+wjoix+lQUNlFrcP5MKwB4 BS7znGg4O2uZ6zOA/qrFGeI= X-Google-Smtp-Source: AA0mqf4037cDMBW0fEWBawiKlQldxMCfKaRaHSyOcCkZIkiHzWUppdgVFABqtUCYoL8rJNW7xtAVDg== X-Received: by 2002:a17:902:ec84:b0:189:c62e:ac32 with SMTP id x4-20020a170902ec8400b00189c62eac32mr18129859plg.109.1670356271243; Tue, 06 Dec 2022 11:51:11 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id f88-20020a17090a28e100b001f94d25bfabsm12983159pjd.28.2022.12.06.11.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 11:51:10 -0800 (PST) Date: Tue, 6 Dec 2022 11:51:08 -0800 From: Nathan Bossart To: Dagfinn Ilmari =?iso-8859-1?Q?Manns=E5ker?= Cc: Andrew Dunstan , Corey Huinker , Tom Lane , Stephen Frost , Bharath Rupireddy , "David G. Johnston" , Kyotaro Horiguchi , Michael Paquier , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: predefined role(s) for VACUUM and ANALYZE Message-ID: <20221206195108.GD3078082@nathanxps13> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <878rjkiwih.fsf@wibble.ilmari.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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