PostgreSQL教程

PostgreSQL中查看版本的几种方式

本文主要是介绍PostgreSQL中查看版本的几种方式,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

PostgreSQL中查看版本的几种方式

1、SQL方式

postgres=# show server_version;
 server_version 
----------------
 13.2
(1 row)
postgres=# select version();
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)

2、pg_config方式

[pg13@mambapg ~]$  pg_config|grep VERSION
VERSION = PostgreSQL 13.2

3、pg_controldata方式

[pg13@mambapg ~]$ pg_controldata --version
pg_controldata (PostgreSQL) 13.2

4、查看告警日志

[pg13@mambapg pg_log]$ pwd
/pg13/pgdata/pg_log
[pg13@mambapg pg_log]$ more postgresql-Mon.log|grep "LOG:  starting PostgreSQL"
2021-04-26 17:06:52.654 CST [10990] LOG:  starting PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2021-04-26 17:33:48.605 CST [15580] LOG:  starting PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2021-04-26 17:36:32.401 CST [15968] LOG:  starting PostgreSQL 13.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit

5、postgres方式

[pg13@mambapg pg_log]$ postgres --version
postgres (PostgreSQL) 13.2
这篇关于PostgreSQL中查看版本的几种方式的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!