小编alx*_*lvt的帖子

尝试在 Postgres 9.3 上设置新的 data_directory

Ubuntu 14.04,最近安装了 Postgres 9.3。

尝试为附加的更大硬盘驱动器 (/data) 设置新的 data_directory,我更改了 postgresql.conf 文件以反映这一点。

但是,尝试重新启动服务器时出现此错误:

user@server:/etc/postgresql/9.3/main$ sudo /etc/init.d/postgresql restart
 * Restarting PostgreSQL 9.3 database server                                     
 * Error: pid file is invalid, please manually kill the stale server process.
Run Code Online (Sandbox Code Playgroud)

我没有太多设置 Postgres 的经验,所以我不确定从这里开始做什么,而且谷歌搜索也没有提供快速答案。

postgresql postgresql-9.3

7
推荐指数
2
解决办法
7458
查看次数

将大型 JSON 文件复制到 Postgres 时出现 \u0000 的 Unicode 错误

我在 Ubuntu 14.04 上使用 Postgres 9.4。

我有一个 30GB JSON 文件,我正在尝试将其复制到 Postgres 中。

但我不断收到以下错误:

COPY <table>(comment_jsonb) FROM '<json file>' WITH (format csv, quote e'\x01', delimiter e'\x02', escape e'\x01');
ERROR:  unsupported Unicode escape sequence
DETAIL:  \u0000 cannot be converted to text.
Run Code Online (Sandbox Code Playgroud)

我尝试搜索有问题的 Unicode 字符串来删除它,但因为它是 \u0000,即 NULL,所以我似乎无法使用正则表达式。当我将其打印到控制台时,我不知道 NULL 在哪里,因为(至少我的猜测是)它似乎什么也没有打印(尽管我不知道它实际上在做什么)。

有没有办法跳过这些错误?

或者,如何替换 JSON 文件中该 Unicode 的任何实例?

json regex postgresql-9.4 unicode

3
推荐指数
1
解决办法
1万
查看次数