Re: createdb.exe and psql.exe without Promting Password

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: createdb.exe and psql.exe without Promting Password
Дата
Msg-id gnjim7$k71$4@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на createdb.exe and psql.exe without Promting Password  (Inigo Barandiaran <ibarandiaran@vicomtech.org>)
Список pgsql-general
On 2009-02-10, Inigo Barandiaran <ibarandiaran@vicomtech.org> wrote:
>
> Hi.
>
> I would like to create an script that includes calls to createdb.exe and
> psql.exe. I would like to use them with a user but without asking or
> prompting for pasword. For example:
>  createdb.exe -T template0 -U MyPosgresUser MyDataBaseName.
>
> I've read that if I define an environment variable like SET
> PGPPASSWORD=MyPosgresUserPassword, both calls dont ask for password. I've
> tested this variable in different platforms and does not work.
> Do you know how so solve it?

no, because it always works for me.

so I'm guessing what you're doing wrong.
you must do the SET in the same (or parent of the) envrionment as you execute createdb.

doing this will not work:

 system("SET PGPPASSWORD=MyPosgresUserPassword");
 system("createdb.exe -T template0 -U MyPosgresUser MyDataBaseName");

doing this will:

 setenv("PGPASSWORD","MyPosgresUserPassword");
 system("createdb.exe -T template0 -U MyPosgresUser MyDataBaseName");


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

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: Accessing array elements in a FOR PL/pgsql loop
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: Fwd: createdb.exe and psql.exe without Promting Password