Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNYbA-0004dm-LY for pgsql-admin@arkaria.postgresql.org; Thu, 14 Jul 2016 04:50:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bNYb9-0008Ia-PA for pgsql-admin@arkaria.postgresql.org; Thu, 14 Jul 2016 04:50:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bNYZS-0006PX-NH for pgsql-admin@postgresql.org; Thu, 14 Jul 2016 04:48:22 +0000 Received: from adriana.opensysperu.com ([158.69.30.115]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bNYZO-0002KG-7k for pgsql-admin@postgresql.org; Thu, 14 Jul 2016 04:48:22 +0000 Received: from localhost (localhost [IPv6:::1]) by adriana.opensysperu.com (Postfix) with ESMTP id 93CEA4DFA; Wed, 13 Jul 2016 23:48:38 -0500 (PET) Received: from adriana.opensysperu.com ([IPv6:::1]) by localhost (adriana.opensysperu.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id bOss4eQY6GjR; Wed, 13 Jul 2016 23:48:36 -0500 (PET) Received: from localhost (localhost [IPv6:::1]) by adriana.opensysperu.com (Postfix) with ESMTP id 369E04DFB; Wed, 13 Jul 2016 23:48:36 -0500 (PET) X-Virus-Scanned: amavisd-new at opensysperu.com Received: from adriana.opensysperu.com ([IPv6:::1]) by localhost (adriana.opensysperu.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id vN30TnhgGAKi; Wed, 13 Jul 2016 23:48:36 -0500 (PET) Received: from adriana.opensysperu.com (adriana.opensysperu.com [158.69.30.115]) by adriana.opensysperu.com (Postfix) with ESMTP id 138A74DFA; Wed, 13 Jul 2016 23:48:36 -0500 (PET) Date: Wed, 13 Jul 2016 23:48:35 -0500 (PET) Subject: Re: Create extension without superuser Message-ID: From: Alvaro Aguayo Garcia-Rada To: pgsql-admin@postgresql.org, Nguyen Hoai Nam MIME-Version: 1.0 In-Reply-To: References: Content-Type: multipart/alternative; boundary="----=_Part_72997_1264334671.1468471715907" X-Mailer: Zimbra 8.6.0_GA_1153 (MobileSync - SonyD6633/5.1.1-EAS-2.0) Thread-Topic: Create extension without superuser Thread-Index: oIOl+xrj8Z6HbhpqoOJxByt/h2VlkA== X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org ------=_Part_72997_1264334671.1468471715907 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable "CREATE EXTENSION" is not itself restricted to superuser. However, various = extensions will create different objects for it's usage: schemas, tables, t= ypes, functions, casts, etc. To "CREATE EXTENSION" as a non-superuser, the = user must have required privileges to create all the objects required by th= e extension. The full SQL script for each extension can be found on /usr/sh= are folder(/usr/share/postgresql/9.4/extension ; may vary by version and di= stro) So, to know wheter a non-superuser can run "CREATE EXTENSION btree_gist;", = we need to check the installation script for btree_gist. And, unfortunatell= y for you, it cannot be run without being superuser. The reason is that it = creates scalar types. Scalar types can only be created with superuser privi= lege, as a bad scalar type definition can lead to server crash. Your best option is to install btree_gist in template1, so it will be autom= atically created on any new database. If you need it on other databases, yo= u can just install it. Regards, Alvaro Aguayo Jefe de Operaciones Open Comb Systems E.I.R.L. Oficina: (+51-1)=C2=A03377813=C2=A0| RPM: #034252 / (+51)=C2=A0995540103=C2= =A0 | RPC: (+51)=C2=A0954183248 Website:=C2=A0www.ocs.pe Sent from my Sony Xperia=E2=84=A2 smartphone ---- Nguyen Hoai Nam wrote ---- Hi everyone. Currently, I would like to create btree_gist with normal user. Do you have any suggesstion to do it? Thank you. ------=_Part_72997_1264334671.1468471715907 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit

"CREATE EXTENSION" is not itself restricted to superuser. However, various extensions will create different objects for it's usage: schemas, tables, types, functions, casts, etc. To "CREATE EXTENSION" as a non-superuser, the user must have required privileges to create all the objects required by the extension. The full SQL script for each extension can be found on /usr/share folder(/usr/share/postgresql/9.4/extension ; may vary by version and distro)

So, to know wheter a non-superuser can run "CREATE EXTENSION btree_gist;", we need to check the installation script for btree_gist. And, unfortunatelly for you, it cannot be run without being superuser. The reason is that it creates scalar types. Scalar types can only be created with superuser privilege, as a bad scalar type definition can lead to server crash.

Your best option is to install btree_gist in template1, so it will be automatically created on any new database. If you need it on other databases, you can just install it.

Regards,

Alvaro Aguayo
Jefe de Operaciones
Open Comb Systems E.I.R.L.

Oficina: (+51-1) 3377813 | RPM: #034252 / (+51) 995540103  | RPC: (+51) 954183248
Website: www.ocs.pe

Sent from my Sony Xperia™ smartphone



---- Nguyen Hoai Nam wrote ----


Hi everyone.

Currently, I would like to create btree_gist with normal user. Do you have any suggesstion to do it?

Thank you.
------=_Part_72997_1264334671.1468471715907--