Re: Providing the password to psql from a script

From: Willem Herremans <willem(dot)herremans(at)belgacom(dot)net>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Providing the password to psql from a script
Date: 2004-02-15 09:27:07
Message-ID: 402F3B6B.7030506@belgacom.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout wrote:

>On Sat, Feb 14, 2004 at 05:11:14PM +0100, Willem Herremans wrote:
>
>
>>I have used the Tcl command
>>
>> set psqlChannel [open "|psql $dbname" RDWR]
>>
>>to create a channel that effectively becomes the input/output channel
>>for psql. By writing to that channel, SQL statements are sent to psql,
>>by reading from that channel, the results are received from psql.
>>
>>That works fine, as long as psql does not prompt for a password. The
>>problem is that psql does not use this channel for prompting for or
>>reading the password. Instead, the password is prompted for on, and read
>>from, the terminal from which the tcl application was started and that
>>is not what I want, because the Tcl application has already received the
>>password from the user. It is, as if psql does not use stdout and stdin
>>for the password.
>>
>>
>
>Look in the manpage for psql, there are several ways to stop it asking for
>passwords, including the PGPASS environment variable, tne .pgpass file and
>setting the user as trust in the config.
>
>Any of these will do what you want...
>
>Hope this helps,
>
>
I am afraid this does not help me very much.

The manpage of psql neither mentions the PGPASS environment variable,
nor the .pgpass file.

I understand that, if the server is configured such that the client can
authenticate wihout password, that psql does not prompt for a password,
but it would be a serious limitation for my application that it cannot
support authenitication by means of password.

Kind regards,

--
Willem Herremans

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pascal Polleunus 2004-02-15 09:44:48 Re: inheritance vs performance
Previous Message nednieuws | charles 2004-02-15 08:48:13 Re: Freelance postgresql related jobs