pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
To: pgsql-admin@postgresql.org, Nguyen Hoai Nam <namptit307@gmail.com>
Subject: Re: Create extension without superuser
Date: Wed, 13 Jul 2016 23:48:35 -0500 (PET)
Message-ID: <h6blkum78rldsrvihgeng2n3.1468471039937@email.android.com> (raw)
In-Reply-To: <CA+vg4mOxQonjZkRbGjhnybhFY3ZoXQJOYChBYOu53RRM-8py5Q@mail.gmail.com>
References: <CA+vg4mOxQonjZkRbGjhnybhFY3ZoXQJOYChBYOu53RRM-8py5Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

"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.

view thread (2+ messages)

Message-ID: <h6blkum78rldsrvihgeng2n3.1468471039937@email.android.com>
Permalink:  ../h6blkum78rldsrvihgeng2n3.1468471039937@email.android.com/
Also on:    postgresql.org/message-id/h6blkum78rldsrvihgeng2n3.1468471039937@email.android.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: aaguayo@opensysperu.com, namptit307@gmail.com
  Subject: Re: Create extension without superuser
  In-Reply-To: <h6blkum78rldsrvihgeng2n3.1468471039937@email.android.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox