Check the Postgres version
This article shows how to check the version of Postgres.
Checking Postgres Version in Windows
C:\Users\Admin>psql --version
psql (PostgreSQL) 14.0
C:\Users\Admin>postgres --version
postgres (PostgreSQL) 14.0
The version shown here is 14.0.
There is another method from the Postgres console. The command is:
postgres=# SELECT version();
version
------------------------------------------------------------
PostgreSQL 14.0, compiled by Visual C++ build 1914, 64-bit
(1 row)
postgres=#
Sometimes in Windows, some errors may occur, such as Postgres psql
commands not being recognized in the Windows environment.
This means that psql
the path to Postgres or is not present in the environment variables.
During the installation, the installation wizard will ask the user if they want to add it to the environment variables. If you missed that part, follow the steps below.
-
Search
Edit the System Environment Variables
and press Enter. -
Click
环境变量
the button in the lower right corner. -
管理员的用户变量
Select from the list路径
. -
Click
编辑
. -
bin
Copy the path to the folder where Postgres is installed . -
Click
新建
and paste路径
. -
Select
OK
and clickApply
.
Check Postgres version in Linux
$ Postgres -version
or,
$ postgres -V
You may get an error, Command Postgres not found
. This means that the Postgres ELF
files cannot be found.
You can find the bin folder and then type the full command with the full path. This will work because the bin folder always contains Postgres
the binary file that runs the command.
The most likely path is this /usr/lib/postgressql/14/bin/Postgres
.
$ locate bin/postgres
/usr/lib/postgressql/14/bin/postgres
Now, run the following command:
$ /usr/lib/postgressql/14/bin/postgres -V
To learn more about Postgres documentation, you can visit here .
For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.
Related Articles
Killing a process ID in PostgreSQL
Publish Date:2025/04/27 Views:191 Category:PostgreSQL
-
Today, we will learn how to kill or stop a running query in the background when working with PostgreSQL database. This may happen if the frontend stops working but a background process is still running. In this case, you may want to kill th
How to install and deploy PostgreSQL as a Docker container
Publish Date:2025/04/27 Views:50 Category:PostgreSQL
-
PostgreSQL , also known as Postgres, is a leading object-relational database system. It is popular because it is highly compliant with the SQL standard and includes additional features that simplify processing complex data sets at scale. Po
Selecting whether a string contains a substring match in PostgreSQL
Publish Date:2025/04/27 Views:186 Category:PostgreSQL
-
Today, we will learn how to find a value in a PostgreSQL string and select it if it matches certain conditions. Suppose you have a string carabc and want to see if it contains a value car . Therefore, you will try to use a function that tel
Add unique constraint after creating table in PostgreSQL
Publish Date:2025/04/27 Views:63 Category:PostgreSQL
-
Today we will learn how to add constraints after the rows in a table have been created UNIQUE . The UNIQUE constraint guarantees that the data in a row is unique in that column. So if the column ID exists, all rows will have unique values,
Creating a Schema in PostgreSQL
Publish Date:2025/04/27 Views:196 Category:PostgreSQL
-
This article will discuss creating schemas in PostgreSQL using SQL queries or psql. CREATE SCHEMA Use the statement to create a pattern in SQL query To create a new schema, execute the following command. CREATE SCHEMA test_schema To view al
Changing User Password in Postgres
Publish Date:2025/04/27 Views:108 Category:PostgreSQL
-
In this article, we will change the user password in Postgres. Changing User Passwords in Postgres Using Windows Open from the menu or search bar SQL Shell (psql) . Connect to the default database using the default port. If you set it up wi
Changing column types in Postgres
Publish Date:2025/04/27 Views:91 Category:PostgreSQL
-
This article shows how to change a column type to another data type in Postgres. ALTER TABLE To change the column type in Postgres, use the command ALTER TABLE table_name ALTER COLUMN column_name [ SET DATA ] TYPE new_type ; Use 表名 , , 列
Importing SQL files in PostgreSQL
Publish Date:2025/04/27 Views:129 Category:PostgreSQL
-
This article discusses how to import SQL files in PostgreSQL. psql Import SQL files in PostgreSQL using command To import the SQL file, run the following command: psql - U dbuser - h localhost databasename filename. sql If the file is locat
Create a table if it does not exist in PostgreSQL
Publish Date:2025/04/27 Views:197 Category:PostgreSQL
-
PostgreSQL is an object-relational database system, which means it can support more complex data types than its competitor MySQL. Apart from the above differences, when writing queries for PostgreSQL and MySQL or other database systems, the