4r73m190r0s
4r73m190r0s

Reputation: 51

Do PostgreSQL CLI commands on Windows work?

Do PostgreSQL CLI commands on Windows work?

I'm trying basic command like --version or -V for PostgreSQL version info, but I can't get any result. I've tried multiple permutations, including:

I made sure that the PostgreSQL service is running. Some commands work, for example \l.

Upvotes: 0

Views: 197

Answers (1)

user330315
user330315

Reputation:

If \l works, then you have already started psql.exe and thus you can only run SQL commands (that need to be terminated with ;) or meta commands that start with \

However there is no meta command to display the version of psql.exe, you can do that only from the Windows command line (cmd.exe)

c:\>psql --version
psql (PostgreSQL) 15.0

c:\>

But that only gives you the version of psql.exe, not the version of the Postgres server. If you want to find out the server version run the SQL command inside of psql:

c:\>psql postgres postgres
psql (15.0)
Type "help" for help.

postgres=# select version();
                          version
------------------------------------------------------------
 PostgreSQL 15.0, compiled by Visual C++ build 1914, 64-bit
(1 row)


postgres=#

Upvotes: 2

Related Questions