Re: Providing the password to psql from a script

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Providing the password to psql from a script
Дата
Msg-id 20040214205328.GA18329@svana.org
обсуждение исходный текст
Ответ на Providing the password to psql from a script  (Willem Herremans <willem.herremans@belgacom.net>)
Ответы Re: Providing the password to psql from a script  (Willem Herremans <willem.herremans@belgacom.net>)
Re: Providing the password to psql from a script  (Troy Campano <troycampano@yahoo.com>)
Список pgsql-general
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,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> If the Catholic church can survive the printing press, science fiction
> will certainly weather the advent of bookwarez.
>    http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow

Вложения

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

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Quad Xeon vs. Dual Itanium
Следующее
От: "nobody"
Дата:
Сообщение: Schizophrenic design and solution to it