Re: postgres connection with port option in shell script

Поиск
Список
Период
Сортировка
От Abhra Kar
Тема Re: postgres connection with port option in shell script
Дата
Msg-id CAFNULEc_rThO60Mt_g86mE2y6-NVhdw=HE9G2ynR1_jokxMyXw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: postgres connection with port option in shell script  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general


On Wed, Feb 14, 2018 at 9:03 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wed, Feb 14, 2018 at 8:21 AM, Abhra Kar <abhra.kar@gmail.com> wrote:

Hi,

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


psql postgresql://$USER:$PASSWORD@$HOST/$DATABASE <<END



If all you are going to do is substitute environment variables into a URI why not just identify the environment variables that psql uses directly, set those, and call "psql" directly.​

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].


​You couldn't even if you wanted to.​  Did you maybe mean the .pg_service.conf file?

You should strongly consider using .pgpass instead of "$PASSWORD" - especially depending upon where perform the export.
 

How I can modify this command with PORT option.



​David J.




Hi David, 
                 I meant .pgpass file with in user home directory.And I followed the link you provided.It worked.Thanks a lot.

Regards,
Abhra
 

В списке pgsql-general по дате отправления:

Предыдущее
От: hmidi slim
Дата:
Сообщение: Join query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Any hope for more specific error message for "value too long..."?