哪个是 Postgres 版本

Which is the Postgres version

我对我环境中安装的 Postgres 版本有疑问。

这是我的os:CentOS Linux release 7.3.1611 (Core)/usr/ 中,我可以看到:pgsql-9.4/ 文件夹。

但是当我这样做时:select version(); 我得到:

PostgreSQL 9.2.18 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 
20150623 (Red Hat 4.8.5-11), 64-bit

那么,我有什么版本?

要确定数据库服务器的版本,请使用select version()(从数据库连接):

postgres=# select version();
                                                version                                                     
----------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.2.14 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit

要确定数据库 客户端 的版本,请使用 psql --version(从您的 shell 命令行):

$ psql --version
psql (PostgreSQL) 9.6.2

服务器是存储数据的地方。客户端是您用来连接服务器的软件。它们可以是不同的版本。

您当然可以拥有多个 Postgres 实例sql。试试这个 sql 以显示您当前的实例位置,以防有多个实例

SHOW data_directory;

只需通过以下命令检查版本:psql --version