Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install just the client tools for PostgreSQL on Windows?

I have a PostgreSQL database on a Linux system that I want to access from my Windows PC. But the only Windows binaries I have been able to find are the full installer, which includes the database server and client.

Is it possible to get a client-only Windows binary install for PostgreSQL from anywhere?

(To clarify, I want the standard PostgreSQL client, psql - not a GUI client or independent tool).

like image 680
Paul Moore Avatar asked Nov 22 '15 12:11

Paul Moore


People also ask

Does Postgres have a client?

PostgreSQL client is defined as connect to the database server using command, utility or third party tool. Basically we are using psql utility to connect the database server from OS interface, also we are using pg_admin tool to interact with database server using client interface.

What is the name of the tool that is used to manage PostgreSQL?

1. pgAdmin. pgAdmin is a tool that has been specifically designed for database management and has a GUI to manage (or administration) PostgreSQL databases.


2 Answers

Unfortunately there is no real client "only" installer.

What you can do, is to download the ZIP archive of the complete Postgres binaries:

http://www.enterprisedb.com/products-services-training/pgbindownload

and then remove the "server" part from it.

When you unzip it, you get the following directories:

 bin doc include lib pgAdmin III share StackBuilder symbols 

You can remove the doc, include, pgAdmin III, StackBuilder and symbols directories. As far as I can tell (but I am not sure) the client also doesn't need the share or lib directories, but you would need to test that. So that leaves only the bin directory.

I think the share directory could be needed for localized error messages in psql but I'm not sure about that.

Inside the bin directory you can essentially remove all .exe files (except psql.exe of course). You can also remove all wx*.dll files, they are only needed for pgAdmin. The libxml2.dll and libxslt.dll are also only needed for the server.

If you do want some of the other client tools, you might want to keep

  • pg_dump.exe
  • pg_dumpall.exe
  • pg_restore.exe

One drawback of this approach is that this requires the Visual C++ Redistributable to be installed. But you can overcome that as well by simply putting the MSVCR120.DLL from some computer where it is installed into the bin directory.

So that leaves you with these files (from the bin directory) that are required for the psql client:

  • iconv.dll (libiconv-2.dll in newer Postgres versions)
  • libeay32.dll
  • libintl-8.dll
  • libpq.dll
  • msvcr120.dll
  • ssleay32.dll
  • zlib1.dll
  • psql.exe

Of course you can also take all that from an existing Postgres installation without the need to download the ZIP archive.


It is obviously not a real installer, but if you put the cleaned up directory into a ZIP file, you can distribute that and whoever needs it just unzips the archive. Personally I find unzip to be the best "installer" anyway (I also use that to install the Postgres server, the Windows installer just has too many quirks)

like image 124
a_horse_with_no_name Avatar answered Sep 20 '22 19:09

a_horse_with_no_name


As of 2020, when you click download the full installer from here , click next and next and you get the option to install only the command line - tools enter image description here. Remember to add the path to the bin folder in the PATH variable.

like image 40
Fact Avatar answered Sep 21 '22 19:09

Fact