-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
replay condition
- scws v 1.2.3 & zhparser-master & postgresql v15.2
- install zhparser
[postgres@localhost bin]$ ./psql
psql (15.2)
Type "help" for help.
postgres=# \c test_zhpr;
You are now connected to database "test_zhpr" as user "postgres".
test_zhpr=# create extension zhparser;
CREATE EXTENSION
test_zhpr=# SELECT * FROM ts_parse('zhparser', '保障房资金压力');
NOTICE: zhparser add dict : "/chason/postgres/code/pg15/data/base/zhprs_dict_test_zhpr.txt" failed!
tokid | token
-------+-------
118 | 保障
110 | 房
110 | 资金
110 | 压力
(4 rows)
There is a error print after execute SQL.
Reason
postgreSQL 15.2 and other versions base directory path changed!
[postgres@localhost base]$ ls
1 16394 4 5
[postgres@localhost base]$ pwd
/chason/postgres/code/pg15/data/base
there is more level by database id. so we need to change code from zhparser.c
/**
* %s datadir is the data directory of the current database
* %s get_database_name(MyDatabaseId) is the name of the current database
* add mydatabaseId to path
*/
snprintf(dict_path, MAXPGPATH, "%s/base/%d/zhprs_dict_%s.txt",
DataDir, MyDatabaseId, get_database_name(MyDatabaseId));
and then, there is no error after execute the SQL.
[postgres@localhost bin]$ ./psql
psql (15.2)
Type "help" for help.
postgres=# \c test_zhpr;
You are now connected to database "test_zhpr" as user "postgres".
test_zhpr=# create extension zhparser;
CREATE EXTENSION
test_zhpr=# SELECT * FROM ts_parse('zhparser', '保障房资金压力');
tokid | token
-------+-------
118 | 保障
110 | 房
110 | 资金
110 | 压力
(4 rows)
eric-gitta-moore
Metadata
Metadata
Assignees
Labels
No labels