Обсуждение: Accessing Extension with out Superuser privilege

Поиск
Список
Период
Сортировка

Accessing Extension with out Superuser privilege

От
"Geo P.C."
Дата:

In PostgreSQL server we created an extension with this command CREATE EXTENSION "uuid-ossp";

For our drupal site with user "drupal_user" we are trying to access this but getting an error as "function uuid_generate_v4() does not exist"
When we give privilege for user "drupal_user" as Superuser we are able to access it.

So please let us know with out giving Superuser privilege how we can give permission for "drupal_user" to access extension or let me know what additional role other than Superuser for accessing extension.

Please update us on it.

Thanks & Regards
Geo

Re: Accessing Extension with out Superuser privilege

От
Tom Lane
Дата:
"Geo P.C." <pcgeopc@gmail.com> writes:
> In PostgreSQL server we created an extension with this command CREATE
> EXTENSION "uuid-ossp";

> For our drupal site with user "drupal_user" we are trying to access this
> but getting an error as "function uuid_generate_v4() does not exist"
> When we give privilege for user "drupal_user" as Superuser we are able to
> access it.

It sounds like your superuser account has a default search_path that
includes the schema this function is in, but your drupal_user account
has a different default search_path that doesn't.  You could put the
extension in a different schema, or change drupal_user's search_path.

            regards, tom lane


Re: Accessing Extension with out Superuser privilege

От
Tom Lane
Дата:
I wrote:
> "Geo P.C." <pcgeopc@gmail.com> writes:
>> In PostgreSQL server we created an extension with this command CREATE
>> EXTENSION "uuid-ossp";

>> For our drupal site with user "drupal_user" we are trying to access this
>> but getting an error as "function uuid_generate_v4() does not exist"
>> When we give privilege for user "drupal_user" as Superuser we are able to
>> access it.

> It sounds like your superuser account has a default search_path that
> includes the schema this function is in, but your drupal_user account
> has a different default search_path that doesn't.  You could put the
> extension in a different schema, or change drupal_user's search_path.

Ah, scratch that (-ENOCAFFEINE).  What seems more likely on re-reading
this is that drupal_user lacks USAGE privilege on whatever schema contains
the uuid-ossp functions.  Depending on which PG version you're using,
I believe that unreadable schemas in your search_path are silently
skipped.  You could confirm that by trying to call the function using
an explicitly schema-qualified function name, and seeing if you get
a permissions error about the schema.

            regards, tom lane