每当我通过 postgres 用户运行以下命令时,我都会不断收到上述错误。
$ /usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin/ -B /usr/lib/postgresql/9.3/bin/ -d /var/lib/postgresql/9.1/main -D /var/lib/postgresql/9.3/main
cannot write to log file pg_upgrade_internal.log
Failure, exiting
Run Code Online (Sandbox Code Playgroud)
我正在使用 Ubuntu 13.10。Postgresql 9.1 和 9.3 都运行正常。
这通常意味着您当前的工作目录是postgres用户无法写入的目录。这就是pg_upgrade将尝试写入的地方。
只需将目录更改为可以写入的另一个目录(或编辑当前目录以允许其他写入)。