Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sriBV-003wXQ-OZ for pgsql-general@arkaria.postgresql.org; Fri, 20 Sep 2024 18:16:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sriBT-00BZxC-G5 for pgsql-general@arkaria.postgresql.org; Fri, 20 Sep 2024 18:16:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sriBT-00BZwt-03 for pgsql-general@lists.postgresql.org; Fri, 20 Sep 2024 18:16:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sriBN-000DGZ-R5 for pgsql-general@postgresql.org; Fri, 20 Sep 2024 18:16:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48KIGcfJ2468703; Fri, 20 Sep 2024 14:16:38 -0400 From: Tom Lane To: Robert Haas cc: Laurenz Albe , Dominique Devienne , pgsql-general@postgresql.org Subject: Re: Why no pg_has_role(..., 'ADMIN')? In-reply-to: References: <42cf78d42a376bf05ca9f5776ad29edc30e784d5.camel@cybertec.at> Comments: In-reply-to Robert Haas message dated "Fri, 20 Sep 2024 12:51:01 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2468701.1726856198.1@sss.pgh.pa.us> Date: Fri, 20 Sep 2024 14:16:38 -0400 Message-ID: <2468702.1726856198@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > I think this already exists. The full list of modes supported by > pg_has_role() is listed in convert_role_priv_string(). You can do > something like pg_has_role('alice', 'USAGE WITH ADMIN OPTION'). This > is not new: it worked in older releases too, but AFAIK it's never been > mentioned in the documentation. Surely that's a bad documentation omission. Do we want to document all the variants convert_role_priv_string allows? They appear functionally equivalent, so I'd be inclined to document just one. 'USAGE WITH ADMIN OPTION' seems a reasonable choice. regards, tom lane