psql password passing problem

Lists: pgsql-hackers
From: pascal Van Puymbroeck <pascal(dot)vanpuymbroeck(at)zenonproductions(dot)be>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql password passing problem
Date: 2009-08-14 15:00:32
Message-ID: 4A857C10.1050108@zenonproductions.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi guys,

I'd like to inform you about the issue of using psql in a dos batch file
on windows vista.

On linux all is very simple, you can easily write in your script

psql -d mydb -U myuser -f myqry.sql < passw.txt

On windows however, psql does not seem to work like this, nor does

type passwd.txt | psql -d mydb -U myuser -f myqry.sql

work

So I tried using

psql -d mydb -U myuser -f myqry.sql -u PGPASSWORD=xxxxxx

But this does not work either, so I turned to the pgpass.conf file and
it seemed like that didn't work either because I wrote

127.0.0.1:5432:mydb:myuser:xxxxxx

so I experimented and the hostname command in my dosbox gave me mistral,
so I tried

mistral:5432:mydb:myuser:xxxxxx

And this did not work either

so at last I tried

localhost:5432:mydb:myuser:xxxxxx

And this worked. I also noticed that PGadmin also displayed my machine
as server 8.3 (localhost:5432).

Maybe this can be fixed in the future, that an ip-address or name of
machine is accepted too ?

Keep up the good work,

Pascal Van Puymbroeck
ZENON productions bvba
BELGIUM


From: Serge Fonville <serge(dot)fonville(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql password passing problem
Date: 2009-08-14 15:18:31
Message-ID: 680cbe0e0908140818x55fc73d6p9b651e4c709f9d53@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

> I'd like to inform you about the issue of using psql in a dos batch file on
> windows vista.
>
> On linux all is very simple, you can easily write in your script
>
> psql -d mydb -U myuser -f myqry.sql < passw.txt
>
> On windows however, psql does not seem to work like this, nor does
>
> type passwd.txt | psql -d mydb -U myuser -f myqry.sql
>
> work
>
> So I tried using
>
> psql -d mydb -U myuser -f myqry.sql -u PGPASSWORD=xxxxxx
>
> But this does not work either, so I turned to the pgpass.conf file and it
> seemed like that didn't work either because I wrote
>
> 127.0.0.1:5432:mydb:myuser:xxxxxx
>
> so I experimented and the hostname command in my dosbox gave me mistral, so
> I tried
>
> mistral:5432:mydb:myuser:xxxxxx
>
> And this did not work either
>
> so at last I tried
>
> localhost:5432:mydb:myuser:xxxxxx
>
> And this worked. I also noticed that PGadmin also displayed my machine as
> server 8.3 (localhost:5432).
>
> Maybe this can be fixed in the future, that an ip-address or name of
> machine is accepted too ?

The first thing that comes to mind is, what is you; listen_address set to?

HTH.

Regards,

Serge Fonville