Re: postgres connection with port option in shell script

From: Andreas Kretschmer <andreas(at)a-kretschmer(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: postgres connection with port option in shell script
Date: 2018-02-14 15:25:21
Message-ID: 9809d836-d598-0b5c-efad-5413d7e92c88@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 14.02.2018 um 16:21 schrieb Abhra Kar:
>
> 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
>
>

postgresql://[user[:password](at)][netloc][:port][,...][/dbname][?param1=value1&...]

Rgards, Andreas

--
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-02-14 15:33:57 Re: postgres connection with port option in shell script
Previous Message Abhra Kar 2018-02-14 15:21:05 postgres connection with port option in shell script