Re: CREATE USER system privilege?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oli Sennhauser <oli(dot)sennhauser(at)bluewin(dot)ch>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: CREATE USER system privilege?
Date: 2003-12-28 16:22:51
Message-ID: 18346.1072628571@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Oli Sennhauser <oli(dot)sennhauser(at)bluewin(dot)ch> writes:
>> You need to use EXECUTE to construct this query as a string.

> Facit: pgplsql does not work for my problem, execute does not work problem.

I didn't think I would have to spell it out in gory detail ...

regression=# create or replace function cruser(text) returns void as '
regression'# begin
regression'# execute ''CREATE USER '' || quote_ident($1);
regression'# return;
regression'# end' language plpgsql;
CREATE FUNCTION
regression=# select cruser('foo');
cruser
--------

(1 row)

regression=# select cruser('bar');
cruser
--------

(1 row)

regression=# select usename from pg_user;
usename
-----------------------
postgres
pleb
foo
bar
(5 rows)

regression=#

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Сизых Павел Леонидович 2003-12-29 00:43:19 7.1.3 -> 7.3.2
Previous Message Oli Sennhauser 2003-12-28 09:42:04 Re: CREATE USER system privilege?