psql 命令“错误:未安装 PostgreSQL 版本 12”

Ber*_*rre 9 postgresql

我已经安装了 PostgreSQL 11,但是由于某种原因,当我psql在终端中输入时PostgreSQL version 12 is not installed出现错误

最近我卸载了一个PostgreSQL服务器,所以我觉得我做得不太好

我怎么能得到 psql 命令 exec 版本 11 而不是 12

截屏

Gry*_*ryu 17

我已经复制了你的案例,这是我解决它的方法:

如果要完全删除它,请使用sudo apt purge postgresql-12answering Yes

  ????????????????????????????????????????????????????????????????????? Configuring postgresql-11 ??????????????????????????????????????????????????????????????????????
  ?                                                                                                                                                                    ? 
  ? Removing the PostgreSQL server package will leave existing database clusters intact, i.e. their configuration, data, and log directories will not be removed. On   ? 
  ? purging the package, the directories can optionally be removed.                                                                                                    ? 
  ?                                                                                                                                                                    ? 
  ? Remove PostgreSQL directories when package is purged?                                                                                                              ? 
  ?                                                                                                                                                                    ? 
  ?                                                  <Yes>                                                     <No>                                                    ? 
  ?                                                                                                                                                                    ? 
  ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? 
Run Code Online (Sandbox Code Playgroud)

在这之后:

sudo psql --version
psql (PostgreSQL) 11.7 (Ubuntu 11.7-2.pgdg19.10+1)
Run Code Online (Sandbox Code Playgroud)

  • 这似乎普遍有效。我首先安装了“postgresql-12”,然后更新为“postgresql-13”,但它仍然使用“postgresql-12”中的“pg_dump”(因此拒绝将重新加载转储到我的“postgresql-13”集群)。Purging 12 也在这里工作。 (2认同)