In practical work scenarios, if you need to identify the PostgreSQL version, you can use several methods to determine it:
- Through SQL Query: You can execute the following SQL query in the psql command-line tool to check the version:
sqlSELECT version();
This SQL command returns the PostgreSQL version information, including the version number and compilation details.
- 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:
bashpostgres --version
or
bashpsql -V
These commands output the PostgreSQL version number, for example, psql (PostgreSQL) 13.3.
- 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:
bashapt show postgresql
- On CentOS:
bashyum info postgresql
2024年8月14日 18:03 回复