Re: Creating role using batch file in windows

From: Lukasz Brodziak <lukasz(dot)brodziak(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Creating role using batch file in windows
Date: 2010-10-26 06:58:24
Message-ID: AANLkTikoz3R5B6gWMdaBZxWL03ckXdumPmeXFKV2vqeK@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

One more question. Does the SET PGPASSWORD sets pass for the role? If
not how to set the password for the role using the script provided.

2010/10/25 Thomas Kellerer <spam_eater(at)gmx(dot)net>:
> 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 probably not 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
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

--
Łukasz Brodziak
II MU Bioinformatyka

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas Kellerer 2010-10-26 08:50:58 Re: Creating role using batch file in windows
Previous Message Gnanakumar 2010-10-26 05:32:06 Re: pg_ctl: server does not shut down