【发布时间】:2015-08-28 07:45:01
【问题描述】:
我用
安装了一个 Postgres 扩展(非重音)sudo su posgres
psql create extension unaccent
现在我可以在 sql 中使用 unccent,但前提是我是 Postgres 用户。
如何让所有/其他用户都可以使用 Postgres 扩展
(我在使用 apt-install 安装的 Postgres 9.3.5 的 Ubuntu 上)
jthinksearch=# \dx;
List of installed extensions
Name | Version | Schema | Description
----------+---------+------------+---------------------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
unaccent | 1.0 | public | text search dictionary that removes accents
(2 rows)
jthinksearch=#
jthinksearch=> \du;
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
ubuntu | | {}
postgres@ip-172-31-39-147:/home/ubuntu/code/jthinksearch/reports/src/main/sql$ 退出 ubuntu@ip-172-31-39-147:~/code/jthinksearch/reports/src/main/sql$ psql jthinksearch psql (9.3.5) 输入“帮助”以获得帮助。
我给了用户超级用户角色,但没有帮助,然后按照建议将架构名称放入,这对错误消息有影响但仍然不起作用
jthinksearch=# \du;
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
ubuntu | Superuser | {}
jthinksearch=# select unaccent(name) from musicbrainz.artist where id=195660;
ERROR: function unaccent(character varying) does not exist
LINE 1: select unaccent(name) from musicbrainz.artist where id=19566...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
jthinksearch=# ^C
jthinksearch=# select public.unaccent(name) from musicbrainz.artist where id=195660;
ERROR: text search dictionary "unaccent" does not exist
jthinksearch=#
【问题讨论】:
-
grant访问扩展中的功能。如果您在自己的架构中创建扩展,您可以简单地授予对该架构中所有内容的访问权限 -
如何,拜托,我尝试了“将 SCHEMA public 中的所有功能全部授予 ubuntu”,但没有效果
-
@a_horse_with_no_name 尝试了我所有的模式,但仍然不起作用
-
对不起,你说
only if I am the postgres用户然后你是光栅ubuntu用户? -
@FabrizioMazzoni 是的,这就是我想要做的,ubuntu 是我使用的默认用户,但我必须 su 到 postgres 用户才能安装,但我仍然不能将它用作 ubuntu 用户
标签: postgresql psql