postgres connection with port option in shell script

From: Abhra Kar <abhra(dot)kar(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: postgres connection with port option in shell script
Date: 2018-02-14 15:21:05
Message-ID: CAFNULEd3cmKgN859g9N3xvTtYcxQYZxKdjGeeJ=WKRtiPL7_uw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I want to get postgres connection in script file. I am executing
below command and successfully getting connected ---

psql postgresql://$USER:$PASSWORD(at)$HOST/$DATABASE <<END

select * from abc;

This is executing with default 5432 port.If postgres is installed to any
other port then port option need to be include here[Don't want to take port
from .pgpass file].

How I can modify this command with PORT option.

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2018-02-14 15:25:21 Re: postgres connection with port option in shell script
Previous Message Melvin Davidson 2018-02-14 15:08:37 Re: Upgrading from Postgresql 9.1 to 10