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
Below are the steps I followed to connect to Amazon Redshift with postgres12 psql on windows:
download postgres 12.4 from below location: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
run the installer which will take few minutes and prompt you for installations options
select command line tools
as shown in below screenshot and install that
Above will install postgres12 command line in below folder C:\Program Files\PostgreSQL\12\bin
. Make sure to add this to your PATH environment variable
open cmd and run command
set PGCLIENTENCODING=UTF8
run psql to connect to redshift. Make sure to change below parameters highlighted in red for your cluster endpoint, userid, copy script file name and log script file name respectively
psql -h redshift-cluster-1.abcdefgh.us-east-1.redshift.amazonaws.com -U demo_user -d dev -p 5439 -f d:\demo\redshift_script.sql -L d:\demo\log_redshift_script.log
all commands in redshift_script.sql file would get executed in PSQL and logs will be stored in log_redshift_script.log file