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 1o7NwJ-00050X-T1 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 21:12:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o7NwH-0006lt-Lx for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 21:12:33 +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 1o7NwH-0006kx-AV for pgsql-hackers@lists.postgresql.org; Fri, 01 Jul 2022 21:12:33 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o7NwD-00083w-DK for pgsql-hackers@postgresql.org; Fri, 01 Jul 2022 21:12:32 +0000 Received: by mail-pl1-x634.google.com with SMTP id r1so3444717plo.10 for ; Fri, 01 Jul 2022 14:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xtlktNyYgym0T2AhOxHBuv88aAg58UQ/Fye0fyHHf4I=; b=UMmup309F0ZQ0dBz0u7fTVIQP63APstLx7xXP66TcFcOvOUENtnG5569S74+cJM5w9 N9JiDDjiClkhp3At1vEzf0sAYe4+9QJdqVtMJ6UYzlIxBF3ut4BXvhasCGJA8V5yaFY3 XtSEtPi6TvkVLSMXr7mGzJXeVX3JEfDEg4cz8ZQloGyA9qw2y2YkU+Tta+I7J4cLGxGw AUWPdMgIrjQrld7N+OfHLEIiBFWVROOm7nsoX/TIWljvGJ4EcT663IBHN6G5DNbEfzke +yc3K8EpYSk+JdYmX/Q7i+EGXsgN5MPUzYUwqXWx9oMtHLM/7fy9S0Hr7evMGXPsjx/H 1Teg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xtlktNyYgym0T2AhOxHBuv88aAg58UQ/Fye0fyHHf4I=; b=K5yXOwtGbLHXc28SLFAz2LRqwpQAhd/HuqY6S5seHjTE1vhbTfnztvnu3F2OMGnX8F +UlzOeADDKHzDlFROdYWqIATNrg6q1A0zVw3E2uyNsr6pWfQU2rlsjb8r8jPqBrebMZ2 ubzzfOXg/6pM67VsZU2APxoDlN4Y8TLIYI7N5XO+lPKkbwUAcwEd8k84lq2BvDO8Eya6 IgQIKwhbkYbETz50calUUg7MQPrtKF72OfN3/Rq+c80Xz6S56zYUR/w1uMs79WSeqmO4 re/AGmdFNeBETQHRVmcEdfa8FgAW/YENXB+wpe5oKNnWJJAlI6nX4b8LhLPAHM5Z/dGb F0CQ== X-Gm-Message-State: AJIora+jBFkAS/Wp4rtcoWJ9Lm3Wqvxe94URo0h2XB1VL1KM0qfx2e8E bUEG9eTSRtzMC3qmOGb6T38= X-Google-Smtp-Source: AGRyM1seGBjUY399BUukQ32vwffrwp3MVyJNxcVKRAzPa/SwKgpXH+0NIIcNIrXcKiT3AsUIbnilhw== X-Received: by 2002:a17:90b:3802:b0:1ed:2434:eb44 with SMTP id mq2-20020a17090b380200b001ed2434eb44mr20793825pjb.85.1656709948236; Fri, 01 Jul 2022 14:12:28 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id cq9-20020a056a00330900b00527bb6ece7dsm8915833pfb.179.2022.07.01.14.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 14:12:27 -0700 (PDT) Date: Fri, 1 Jul 2022 14:12:25 -0700 From: Nathan Bossart To: Robert Haas Cc: Joe Conway , Tom Lane , "Bossart, Nathan" , Stephen Frost , PostgreSQL-development Subject: Re: replacing role-level NOINHERIT with a grant-level option Message-ID: <20220701211225.GA418166@nathanxps13> References: <20220629231939.GA362451@nathanxps13> <20220630232931.GA367181@nathanxps13> <20220701025830.GA369935@nathanxps13> <12e2f0cb-08ff-c65f-d31e-76cea1af70ec@joeconway.com> <442d7887-645d-0e31-e971-7a8dc8952d2f@joeconway.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jul 01, 2022 at 02:59:53PM -0400, Robert Haas wrote: > And here is a patch that makes it work that way. In this version, you > can GRANT foo TO bar WITH INHERIT { TRUE | FALSE | DEFAULT }, and > DEFAULT means that role-level [NO]INHERIT property is controlling. > Otherwise, the grant-level option overrides the role-level option. I haven't spent a ton of time reviewing the patch yet, but I did read through it and thought it looked pretty good. > I have some hesitations about this approach. On the positive side, I > believe it's fully backward compatible, and that's something to like. > On the negative side, I've always felt that the role-level properties > - [NO]INHERIT, [NO]CREATEROLE, [NO]SUPERUSER, [NO]CREATEDB were hacky > kludges, and I'd be happier they all went away in favor of more > principled ways of controlling those behaviors. I think that the > previous design moves us in the direction of being able to eventually > remove [NO]INHERIT, whereas this, if anything, entrenches it. +1. As mentioned upthread [0], I think attributes like CREATEROLE, SUPERUSER, and CREATEDB could be replaced with predefined roles. However, since role attributes aren't inherited, that would result in a behavior change. I'm curious what you have in mind. It might be worth spinning off a new thread for this sooner than later. > It might even encourage people to add *more* role-level Boolean flags. > For instance, say we add another grant-level property that controls > whether or not you can SET ROLE to the granted role. Well, it somebody > going to then say that, for symmetry with CREATE ROLE .. [NO]INHERIT > we need CREATE ROLE .. [NO]SETROLE? I think such additions would be > actively harmful, not only because they add complexity, but also > because I think they are fundamentally the wrong way to think about > these kinds of properties. Perhaps there should just be a policy against adding new role-level options. Instead, new functionality should be provided via predefined roles or grant-level options. There is some precedent for this. For example, VACUUM has several options that are only usable via the parenthesized syntax, and the unparenthesized syntax is marked deprecated in the documentation. (Speaking of which, is it finally time to remove the unparenthesized syntax or add WARNINGs when it is used?) For [NO]INHERIT and WITH INHERIT DEFAULT, presumably we could do something similar. Down the road, those would be removed in favor of only using grant-level options. [0] https://postgr.es/m/20220602180755.GA2402942%40nathanxps13 -- Nathan Bossart Amazon Web Services: https://aws.amazon.com