PostgreSQL中查看版本的几种方式


PostgreSQL中查看版本的几种方式

1、SQL方式

1 2 3 4 5 6 7 8 9 10 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方式

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

3、pg_controldata方式

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

4、查看告警日志

1 2 3 4 5 6 [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方式

1 2 [pg13@mambapg pg_log]$ postgres --version postgres (PostgreSQL) 13.2
转自:

http://www.zyiz.net/tech/detail-273823.html