乐闻世界logo
搜索文章和话题

Which version of PostgreSQL am I running?

1个答案

1

In practical work scenarios, if you need to identify the PostgreSQL version, you can use several methods to determine it:

  1. Through SQL Query: You can execute the following SQL query in the psql command-line tool to check the version:
sql
SELECT version();

This SQL command returns the PostgreSQL version information, including the version number and compilation details.

  1. Through Command Line: If you have access to the server, you can use the following commands in the command line to check the PostgreSQL version:
bash
postgres --version

or

bash
psql -V

These commands output the PostgreSQL version number, for example, psql (PostgreSQL) 13.3.

  1. Check Package Manager: If PostgreSQL is installed via a package manager (such as APT for Ubuntu, YUM/DNF for Fedora/CentOS), you can query the installed PostgreSQL version using the package manager:
  • On Ubuntu:
bash
apt show postgresql
  • On CentOS:
bash
yum info postgresql
2024年8月14日 18:03 回复

你的答案