Re: Creating role using batch file in windows

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Creating role using batch file in windows
Дата
Msg-id ia42qk$fb7$1@dough.gmane.org
обсуждение исходный текст
Ответ на Creating role using batch file in windows  (Lukasz Brodziak <lukasz.brodziak@gmail.com>)
Ответы Re: Creating role using batch file in windows  (Lukasz Brodziak <lukasz.brodziak@gmail.com>)
Список pgsql-admin
Lukasz Brodziak, 25.10.2010 15:49:
> Hello,
>
> What I need to do is create a batch file to be sent to client in which
> I have to perform create role statement. Best thing would be if the
> user didn't see what is happening in the console (is there a @echo off
> equivalent for psql). Can anyone help me with this.
>

The problem with a batch file is that you will need to provide the password for the superuser in clear text - which is
probablynot something you will want to do. 

But if that isn't a problem (and you actually know the superuser password of your client) then the following might
work:

------------- snip ---------------
@echo off
setlocal

set PGHOST=localhost
set PGUSER=postgres
set PGPASSWORD=the_super_secret_password

createuser role_1 1> nul 2>&1
createuser role_2 1> nul 2>&1
...

endlocal
------------- snip ---------------


Regards
Thomas

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

Предыдущее
От: Lukasz Brodziak
Дата:
Сообщение: Creating role using batch file in windows
Следующее
От: Greg Smith
Дата:
Сообщение: Re: pg_ctl: server does not shut down