amutu / zhparser

zhparser is a PostgreSQL extension for full-text search of Chinese language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Permission denied

abcfy2 opened this issue · comments

在create extension的时候报错Permission denied.

jupiter=# create extension zhparser ;
ERROR:  could not open file "/usr/share/postgresql/10/tsearch_data/qc_dict_jupiter.txt" for writing: Permission denied
HINT:  COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy.
CONTEXT:  SQL statement "copy (select word, tf, idf, attr from zhparser.zhprs_custom_word) to '/usr/share/postgresql/10/tsearch_data/qc_dict_jupiter.txt' encoding 'utf8'"
PL/pgSQL function sync_zhprs_custom_word() line 11 at EXECUTE

我看了下更新内容,原来是2.0版本新增了自定义词库的功能,自定义词库存储在/usr/share/postgresql/10/tsearch_data/中,这个目录是root权限,对于postgres用户无写入权限,手动改这个目录的属主即可规避这个错误

chown -R postgres:postgres /usr/share/postgresq/10/tsearch_data

但是还是希望官方可以有办法规避这个问题。比如可以考虑默认放到/var/lib/postgresql/10/data/中,这是postgresql配置的数据目录,默认是有权限写入的。

@amutu Thanks.

done, 2.1版本已经将字典放到数据目录下了。