From: Oli Sennhauser <oli.sennhauser@bluewin.ch>
To: pgsql-admin@postgresql.org
Subject: Re: CREATE USER system privilege?
Date: Sun, 07 Mar 2004 17:38:48 +0100
Message-ID: <404B5018.1020805@bluewin.ch> (raw)
In-Reply-To: <18346.1072628571@sss.pgh.pa.us>
References: <3FE6D077.7000403@bluewin.ch>
<15986.1072106106@sss.pgh.pa.us>
<3FEEA56C.6080709@bluewin.ch>
<18346.1072628571@sss.pgh.pa.us>
Hi admins
Long ago I was asking about system privilege "create user" and
procedures to create users without superuser rights.
Now I have finished some pgplsql-Procedures for granting this rights to
a normal operator.
You can find them on
http://mypage.bluewin.ch/shinguz/PostgreSQL/skripts/f_create_user.tar.gz
Regards Oli
Tom Lane wrote:
>Oli Sennhauser <oli.sennhauser@bluewin.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
>
>
>
--
-------------------------------------------------------
Haben Sie Ihre Firma schon im FOSS-Directory (www.foss-directory.ch) eingetragen?
Oli Sennhauser
Database-Engineer (Oracle & PostgreSQL)
Rebenweg 6
CH - 8610 Uster / Switzerland
Phone (+41) 1 940 24 82
e-Mail oli.sennhauser@bluewin.ch
Website http://mypage.bluewin.ch/shinguz/PostgreSQL/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: oli.sennhauser@bluewin.ch
Subject: Re: CREATE USER system privilege?
In-Reply-To: <404B5018.1020805@bluewin.ch>
References: <3FE6D077.7000403@bluewin.ch> <15986.1072106106@sss.pgh.pa.us> <3FEEA56C.6080709@bluewin.ch> <18346.1072628571@sss.pgh.pa.us> <404B5018.1020805@bluewin.ch>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox