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 1o7GL1-000329-0b for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 13:05: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 1o7GKz-0000xN-VC for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2022 13:05: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 1o7GKz-0000wu-Ly for pgsql-hackers@lists.postgresql.org; Fri, 01 Jul 2022 13:05:33 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o7GKw-00047W-PK for pgsql-hackers@postgresql.org; Fri, 01 Jul 2022 13:05:32 +0000 Received: by mail-ej1-x632.google.com with SMTP id sb34so3928072ejc.11 for ; Fri, 01 Jul 2022 06:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1o0lZFxgoweB+s7J1P12QDTUSaTWoKlleo7J1raDhfA=; b=Ixe8dxMU5ku2x8qiaVHHiAuTKlFucKmaxyG/+Fo21a45gJLv0melrkDR7V/SP/CDjD Ay2sVwsjDtuiYaZxKzE4r4cITyEjcS9mSOo989SKH4rp4WAEbAmKCgw3+4DflHNwd5R4 ae+HIXTnLyehv8RcVb4LlNx+D+GpN02HdcLho51ITpiXAYkGgcUGaosl+sbi3DC9gObN VGrnWf9VmVZncqNU0A32uRLZeuTdWIKCRuceeC3NLmDa87OtPMrhNyRn6plfM8oDL9wN gm0pG40Vi6pQsiq7U3z7xT1HFGzExMljIKh3CoIodv/2ZHIQHHUyekfjVzkQ1FHFJsGr Te2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1o0lZFxgoweB+s7J1P12QDTUSaTWoKlleo7J1raDhfA=; b=HIniJljklA2mBTOeMOd4HPAQJ817nUcXQBkG2LaX7yCygmRoO0ELb8UF4uoE1fC9Ds qUmHCLdISGkPSUTdpPBs5g9a6kKmh+U5X52fXch/8S8hVmGL0G1zkffoFkHM7NaAqzLn 9NAFR+kRvhNMePMwGuGI0tiUUceUM1UKt9zo2o5zz21SBirzESfgl0T7A6JoZPjzUwLj nSR0PdOP+Lf05KSWfQPlrM8PEtCKtCxbmqIHojRDNsfBSfCUy8G6Zgy45rx3vQEoqdpB G2VNrKe9KOh/WdMPbJGP+tfsctghVicVh50+GzfJBEUxcOmYYb+FMFaNxWF439eP3SFp Bp3g== X-Gm-Message-State: AJIora9j9/nDexVPcUraOT+A6AG1M1eVf3n1Q8YSSrEkftDZFcleU6gD 4a4hG0zXS0WHWUL4+cD/Z67gnCENLkPFzI8Uar0= X-Google-Smtp-Source: AGRyM1uLH42E2qWSWYcqYa+XSpoe97Xc2xjdwfJC7kFuzyUFgd1KbEuZ3c8NqYw7SdXwKSRKgzN37hlbd94dOQeH4Zk= X-Received: by 2002:a17:906:6a03:b0:726:c0e5:d58a with SMTP id qw3-20020a1709066a0300b00726c0e5d58amr14321756ejc.288.1656680728936; Fri, 01 Jul 2022 06:05:28 -0700 (PDT) MIME-Version: 1.0 References: <730520.1644168290@sss.pgh.pa.us> <80af9ba7-ec24-9134-8fd9-00bf13f5c494@joeconway.com> <1066202.1654190251@sss.pgh.pa.us> <20220629231939.GA362451@nathanxps13> <20220630232931.GA367181@nathanxps13> <20220701025830.GA369935@nathanxps13> <12e2f0cb-08ff-c65f-d31e-76cea1af70ec@joeconway.com> <442d7887-645d-0e31-e971-7a8dc8952d2f@joeconway.com> In-Reply-To: <442d7887-645d-0e31-e971-7a8dc8952d2f@joeconway.com> From: Robert Haas Date: Fri, 1 Jul 2022 09:05:16 -0400 Message-ID: Subject: Re: replacing role-level NOINHERIT with a grant-level option To: Joe Conway Cc: Nathan Bossart , Tom Lane , "Bossart, Nathan" , Stephen Frost , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jul 1, 2022 at 8:22 AM Joe Conway wrote: > Hmm, maybe I am misunderstanding something, but what I mean is something > like: > > 8<---------------- > CREATE TABLE t1(f1 int); > CREATE TABLE t2(f1 int); > > CREATE USER A; --defaults to INHERIT > CREATE USER B; > CREATE USER C; > > GRANT select ON TABLE t1 TO B; > GRANT select ON TABLE t2 TO C; > > GRANT B TO A; > GRANT C TO A; > > SET SESSION AUTHORIZATION A; > > -- works > SELECT * FROM t1; > -- works > SELECT * FROM t2; > > RESET SESSION AUTHORIZATION; > REVOKE INHERIT OPTION FOR C FROM A; > SET SESSION AUTHORIZATION A; > > -- works > SELECT * FROM t1; > -- fails > SELECT * FROM t2; > 8<---------------- > > So now A has implicit inherited privs for t1 but not for t2. Yeah, I anticipate that this would work in the way that you postulate here. -- Robert Haas EDB: http://www.enterprisedb.com