| From: | Guillaume Lelarge <guillaume(at)lelarge(dot)info> |
|---|---|
| To: | plop plop <mr_weetos(at)hotmail(dot)com> |
| Cc: | pgadmin-support(at)postgresql(dot)org |
| Subject: | Re: Pgscript : error creating a user with a variable as the password |
| Date: | 2012-03-18 08:40:43 |
| Message-ID: | 4F659F8B.7070502@lelarge.info |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgadmin-support |
Le 16/03/2012 14:23, plop plop a écrit :
> Hi all,
>
> This is a problem about creating a user with a password thanks to a
> pgscript (pgadmin 1.14.1). I have searched a while around the internent,
> but I have found no solution so far.
>
> The following script does not work ("error near « password»". Pgadmin is
> in French, so i do not know how the warning exactly looks like in English) :
>
> declare @USER, @PASS;
> set @USER='user';
> set @PASS='password';
>
> CREATE ROLE @USER LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE
> PASSWORD @PASS;
>
>
> Whereas this one does :
>
> declare @USER;
> set @USER='user';
>
> CREATE ROLE @USER LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE
> PASSWORD 'password';
>
>
> What am I doing wrong with the @PASS variable ?
>
You need to add quotes around it, this way:
CREATE ROLE @USER LOGIN NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE
PASSWORD '@PASS';
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Guillaume Lelarge | 2012-03-18 08:43:36 | Re: code completion feature question |
| Previous Message | Guillaume Lelarge | 2012-03-18 08:37:58 | Re: Server status hanging on OS X |