From: | Tatarnikov Alexander <cankrus(at)gmail(dot)com> |
---|---|
To: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Use "CREATE USER" in plpgsql function |
Date: | 2010-09-15 04:05:03 |
Message-ID: | AANLkTi=u7vWFrgTzzE5zXUoT=4vqQt1tSH-A+s-K=JzU@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello!
I have function wich check user credentials and if test passed function must
create new user with generated username and password.
Language is plpgsql.
For example:
....
DECLARE creds RECORD;
...
SELECT * INTO creds FROM ...
creds is Record with fields userName(VARCHAR) and userPassword(VARCHAR)
so when i use CREATE USER creds."userName" WITH PASSWORD
creds."userPassword"
i get an error, because creds."userName" is VARCHAR and thus when function
runs it will be look like this:
CREATE USER 'user_1'
but right command is
"CREATE USER user_1" OR " CREATE USER "user_1" "
so question is how to "unembrace" this parameter (i mean creds."userName")?
Thanks
--
------
Alexander
From | Date | Subject | |
---|---|---|---|
Next Message | Sergey Konoplev | 2010-09-15 06:40:38 | Re: Use "CREATE USER" in plpgsql function |
Previous Message | Tom Lane | 2010-09-14 17:51:38 | Re: 9.0rc1 - query of view produces unexpected results |