Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jDGX2-0007ZN-Rw for pgsql-docs@arkaria.postgresql.org; Sat, 14 Mar 2020 23:49:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDGX0-0002fH-IM for pgsql-docs@arkaria.postgresql.org; Sat, 14 Mar 2020 23:49:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jDGX0-0002f6-6C for pgsql-docs@lists.postgresql.org; Sat, 14 Mar 2020 23:49:26 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jDGWt-0008LY-DC for pgsql-docs@lists.postgresql.org; Sat, 14 Mar 2020 23:49:24 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jDGWr-0000Bh-W5; Sat, 14 Mar 2020 19:49:17 -0400 Date: Sat, 14 Mar 2020 19:49:17 -0400 From: Bruce Momjian To: randolph.a.strauss@nasa.gov, pgsql-docs@lists.postgresql.org Subject: Re: create extension requires superuser? Message-ID: <20200314234917.GD22336@momjian.us> References: <158111077755.1088.5569143599421077335@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <158111077755.1088.5569143599421077335@wrigleys.postgresql.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Feb 7, 2020 at 09:26:17PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/10/sql-createextension.html > Description: > > https://www.postgresql.org/docs/10/sql-createextension.html > "For most extensions this means superuser or database owner privileges are > needed" > (this is the same text for version 12, but I haven't tried that version.) > > If I create a database, I can't CREATE EXTENSION postgis; > unless I'm superuser. Is this bad documentation or is it just for this > extension? > It should be documented how to tell. Well, our docs say: https://www.postgresql.org/docs/12/sql-createextension.html Loading an extension requires the same privileges that would be required to create its component objects. For most extensions this means superuser or database owner privileges are needed. The user who runs CREATE EXTENSION becomes the owner of the extension for purposes of later privilege checks, as well as the owner of any objects created by the extension's script. Looking at the adminpack extension, I think anyone can install it, but most/all of the functions internally call requireSuperuser(), and that errors for non-superusers with: only superuser may access generic file functions Unfortunately, there is no SQL-level ability to check which functions require super-user rights. It is buried in the C code. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +